JSON Request Stop Working on Production Server

Events happening in the community are now at Drupal community events on www.drupal.org.
gbernier's picture

Update:
Ends up the issue was connected with the hosting provider upgrading to PHP 5.2.14 as there were updates done to json_decode which made the way I was passing in my arguments on PHP 5.1.6 fine but in the latest version of PHP would return null. Updated the data argument to be
data: {method: '"car_service.get_product_listing"', tids: '"' + selectedTid + '"'}, (This item in JSON issue queue says to use the double quotes around arguments because json_decode expects them, http://drupal.org/node/884708)

Hey All,

I've ran into this very odd issue where a clients site has stop responding to JSON requests. The site has been up in production since the middle of July and we've had no issues until now. Getting a response to my POST of {#error:true, #data: "Invalid method "}. Looking through the code it should at the very least be including the $request variable in this message, which is populated with this line $request = drupal_parse_json($_POST['method']);

Client claims not to have touched any of the files and hasn't changed any setting in the back end. Test it on our local development servers and the we are getting proper responses and adding some debugging show's the $_POST['method'] is populated on development but not in Production

Production JSON response with some debugging info: (I did a print_r on the $_POST to see what was going in)
Array
(
[method] => car_service.get_product_listing
[tids] => 25,
)
{ "#error": true, "#debug": "1.0 - Request received, 1.1 - Post - 1, 1.2 - Post Method Stripped = , 1.3 - Args passed? = 25,", "#data": "Invalid method " }

Based on this information I can see method is in the POST variable but when it comes out of drupal_parse_json the $request variable is blank

And on our development server this is what gets returned with the exact same request
Array
(
[method] => car_service.get_product_listing
[tids] => 25,
)
{ "#error": false, "#debug": "1.0 - Request received, 1.1 - Post - 1, 1.2 - Post Method Stripped = car_service.get_product_listing, 1.3 - Args passed? = 25,", "#data": "..."}

Has anyone experienced this before? If so any help would be appreciated.

Services

Group organizers

Group categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: