Oddities

From MapbenderWiki

Jump to: navigation, search

__toString() faulty in PHP < 5.2

$bbox = new Mapbender_bbox($minx, $miny, $maxx, $maxy, $epsg)
$e = new mb_exception("bbox is " . $bbox);

returns the following in PHP < 5.2

bbox is Object Id #xy

in PHP >= 5.2 something like

bbox is [1234,1234,3245,2345,EPSG:34253]

but if called directly via echo, it works even in < 5.2

echo $bbox;

results in the desired output

bbox is [1234,1234,3245,2345,EPSG:34253]

SimpleXML->children() behaves different in PHP 5.0.4 and 5.2

if a SimpleXMLElement contains multiple siblings, children() returns

  • all children of the first sibling in 5.0.4
  • all siblings in 5.2

You can avoid this by switching between DOM and SimpleXML by using these functions

  • simplexml_import_dom(DOMNode)
  • dom_import_simplexml(SimpleXMLElement)

parent.$.toJSON() faulty

the typeof operator cannot determine the correct type of arrays in iframes.

This results in faulty detection of arrays as objects.

Instead of

[1,2,3]

you get

{"0":1, "1":2, "2":3}

Avoid iframes or load jQuery and jqson in the the iframe as well.

Personal tools