I have problems when I receive certain strings via the www class from a php file. At the php end, I echo a string and some strings freeze the Unity script that was making the WWW call (Unity 4.6.0). If I call the php file from the browser (direct url address) then it never gives any problems. The strings are always echoed fine.
The strings that I want to echo are the result of json_encode, but that shouldn’t matter. In my debugging mode, I have created a string that looks like the json_encoded string. Then I have tried different versions of the string, to see which ones freeze the calling app. So the php code ends like this:
$matches = 'one string’;
echo $matches;
See below the different strings I tried ($matches). DOES NOT WORK = this string freezes the calling app; WORKS = with this string the AJAX call is completed successfully, the app receives the data and moves on
$matches = '[{"Start":"2015-02-02 08:00:00","Duration":"15","nSituations":1}]'; // DOES NOT WORK
$matches = '[{"Start":"2015-02-02 08:00:00","Duration":"15"}]'; // WORKS
$matches = '[{"Start":"2015-02-02 08:00:00","nSituations":1}]'; // WORKS
$matches = '[{"Duration":"15","nSituations":1}]'; // WORKS
$matches = '[{"Start":"A","Duration":"15","nSituations":1}]'; // WORKS
$matches = '[{"Start":"2015-02-02 08:00:00","Duration":"15","nSituations":"1"}]'; // DOES NOT WORK (notice nSituations as STRING)
$matches = '[{"Start":"2015-02-02","Duration":"15","nSituations":"1"}]'; // DOES NOT WORK
$matches = '[{"Start":"08:00:00","Duration":"15","nSituations":"1"}]'; // DOES NOT WORK
$matches = '[{"Start":"08:00:00","Duration":"15","nSituations":1}]'; // DOES NOT WORK (nSituations back as INT)
$matches = '[{"Start":"2015-02-02 08:00:00"}]'; // WORKS
I can’t see any pattern. Does anyone know what is going on here? There’s this older post, but it does not quite help me, I don’t think.