[development] parseJson behaves differently under PHP 5.0

Dan Robinson dan at civicactions.com
Tue May 2 19:25:41 UTC 2006


hmmm...

Well my code works under 4.x and not under 5.x - so it is different. 
I'm just starting to understand all this so I'm a little lost.  My
current code does this:

function addContactsToMap(httpresponse, xmlhttp, contacts) {
  if (xmlhttp.status != 200) {
    alert('An HTTP error '+ xmlhttp.status +' occured.\n'+
httpresponse);   
  }  ;
    map.clearOverlays();
    var parsed = parseJson(httpresponse);
    for ( x in parsed ) {
       addContactToMap(parsed[x][0], parsed[x][1], parsed[x][2]);
    }
}

suggestions about what to do to get this to work under 5.x?

Thanks,

Dan
> Looks like sequential arrays are converted to JS objects in PHP 4.
> Still, due to the array/object duality in JS, this is not that much of
> a problem. Just something to look at later.
>
> Steven Wittens
>
>



More information about the development mailing list