Advertisement
simonwheatley

Weird get_query_var bug

Dec 3rd, 2011
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.41 KB | None | 0 0
  1. // THIS WORKS IN WAMP
  2.  
  3. /**
  4.  * Hook the WP parse_query action, check if we're supposed to be
  5.  * processing an upload or not.
  6.  *
  7.  * @param object $query A WP_Query object
  8.  * @return void
  9.  **/
  10. public function parse_query( $query ) {
  11.     // Check the request relates to us
  12.     if ( ! (bool) $query->get( 'mb_dlr_receipt' ) )
  13.         return;
  14.     $this->process_delivery_receipt();
  15.     exit;
  16. }
  17.  
  18. // THIS DOES NOT WORK IN WAMP, BUT DOES WORK FOR *NIX I BELIEVE
  19.  
  20.  
  21. /**
  22.  * Hook the WP parse_query action, check if we're supposed to be
  23.  * processing an upload or not.
  24.  *
  25.  * @param object $query A WP_Query object
  26.  * @return void
  27.  **/
  28. public function parse_query( $query ) {
  29.     // Check the request relates to us
  30.     if ( ! (bool) get_query_var( 'mlb_dlr_receipt' ) )
  31.         return;
  32.     $this->process_delivery_receipt();
  33.     exit;
  34. }
  35.  
  36. // AND HERE'S THE STACK TRACE
  37.  
  38.  
  39.  
  40. ( ! ) Fatal error: Call to a member function get() on a non-object in C:\wamp\www\wp-includes\query.php on line 27
  41. Call Stack
  42. #   Time    Memory  Function    Location
  43. 1   0.0017  952928  {main}( )   ..\plugins.php:0
  44. 2   0.0023  1072480 require_once( 'C:\wamp\www\wp-admin\admin.php' )    ..\plugins.php:10
  45. 3   0.0025  1093304 require_once( 'C:\wamp\www\wp-load.php' )   ..\admin.php:30
  46. 4   0.0026  1111392 require_once( 'C:\wamp\www\wp-config.php' ) ..\wp-load.php:29
  47. 5   0.0031  1238456 require_once( 'C:\wamp\www\wp-settings.php' )   ..\wp-config.php:91
  48. 6   0.1583  28539480    include_once( 'C:\wamp\www\wp-content\plugins\jigoshop\jigoshop.php' )  ..\wp-settings.php:192
  49. 7   0.2047  35591416    jigoshop_singleton::instance( ) ..\jigoshop.php:104
  50. 8   0.2047  35591952    jigoshop_cart->__construct( )   ..\jigoshop_singleton.php:35
  51. 9   0.2047  35591952    jigoshop_cart->get_cart_from_session( ) ..\jigoshop_cart.class.php:43
  52. 10  0.2047  35593848    jigoshop_product->jigoshop_product( )   ..\jigoshop_cart.class.php:63
  53. 11  0.2057  35617632    jigoshop_product->get_children( )   ..\jigoshop_product.class.php:93
  54. 12  0.2057  35618048    get_children( ) ..\jigoshop_product.class.php:129
  55. 13  0.2058  35620272    get_posts( )    ..\post.php:298
  56. 14  0.2058  35629704    WP_Query->query( )  ..\post.php:1390
  57. 15  0.2058  35632504    WP_Query->get_posts( )  ..\query.php:2904
  58. 16  0.2058  35632640    WP_Query->parse_query( )    ..\query.php:1909
  59. 17  0.2061  35644128    do_action_ref_array( )  ..\query.php:1663
  60. 18  0.2061  35645168    call_user_func_array ( )    ..\plugin.php:486
  61. 19  0.2062  35645200    MBESMS->parse_query( )  ..\plugin.php:486
  62. 20  0.2062  35645280    get_query_var( )    ..\class-mbesms.php:128
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement