Are you sure you've got your PHP versions right?
From the documentation for foreach
:
As of PHP 5, it is possible to iterate
objects too.
Try using json_decode
with the second argument set to true
, to make json_decode
return associative arrays rather than objects.
$incomingData = json_decode($_POST['data'], true);
Where the second argument, $assoc
(defaults to false
) means:
When TRUE
, returned objects will be converted into associative arrays.
My guess is that one box has less than PHP 5.
To confirm that's the issue, try changing $incomingData
to some kind of innocuous associative array:
$incomingData = array("foo" => "bar", "baz" => "monkey");
and see if that makes the error go away.