Saturday, 6 August 2016

MapGuide tidbits: mapguide-rest and PHP 5.6

Since MapGuide Open Source 3.1 Beta 2 shipped with PHP 5.6, some might be wondering if my mapguide-rest extension will work on this version of PHP (from a compatibility standpoint, we mainly are referring to the MapGuide API itself, which is the same as before, and not the surrounding Web Tier environment like PHP, Tomcat, etc).

The good news is: Yes, it works for the most part

I say that because, if you see a message like this:

Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version

It's because of some some deprecation warnings that are active in PHP 5.6. This message in particular, is due to the setting always_populate_raw_post_data not being disabled in php.ini.

And for another interesting fact? It's not set to 1, which should imply the setting is disabled right? Well you guessed wrong, it has to be explicitly set to -1 in php.ini for it to be disabled. Once disabled, these warning messages go away.

Another thing to look out for from the client-side is that PHP 5.6 may include charset in its Content-Type response headers. So if your client code was previously testing for application/json
exactly for a JSON response, that may fail now because PHP 5.6 will most likely send down application/json; charset=utf-8 instead. If you have such code, adjust accordingly.

But besides that, my mapguide-rest function test suite says things are A-OK with this release of PHP.

For a better out-of-the-box experience, we'll look to have this setting default to -1 in the php.ini we ship with MapGuide.

No comments: