PHP 5.3 and support for HTTP_SERVER_VARS (etc.)
This won’t affect most customers, but we’ve changed one of the “php.ini” settings for PHP 5.3. The “register_long_arrays” setting (which defaults to “Off” in PHP 5.3) has been changed to “On”, as it was in PHP 5.2.
What does register_long_arrays do?
In very old versions of PHP, it was recommended to use predefined variables with names like “HTTP_SERVER_VARS”. A different method was introduced with PHP version 4.1 back in 2001, and support for these old variable names was disabled by default in version 5.3.
Almost no PHP code uses the old variables names any more. However, two of our customers reported their scripts didn’t work after upgrading to PHP 5.3, and they weren’t sure why. The answer turned out to be PHP 4 code that used the old variable names and hadn’t been rewritten for PHP 5 compatibility.
To minimize the risk of this affecting anyone else, we’ve enabled an option that the PHP authors provided in PHP version 5.3, “register_long_arrays“. When enabled, it allows the old variable names to work for the remainder of the PHP 5.3 series (but not in the future PHP 5.4).
We’ll separately identify and notify any customers still using the old variable names about the problem, so they can fix it before PHP 5.4 is the standard on our servers.
How do I fix my code if I’m still using the old names?
If we tell you your scripts have this problem, it’s easy to fix. Here are the seven old names and the names they should be replaced with in modern PHP code:
|Old name||New name|
For example, if your code uses a line like this:
It should be replaced with:
That’s all it takes — you can probably fix all your code in a few minutes with seven global “search and replace” operations.