Innovative Web Design and Application Development News

May 10th, 2012
May 10th, 2012

PHP 5.4 Gotchas for Developers

A few fixes/enhancements might cause you some grief

After running PHP 5.4 on my development environment for a while I have hit several things that could easily cause enough grief that they need calling attention to. These are new features or changes that will break some existing edge cases in somewhat hidden or obscure ways and can take a long time to find if you don´t know what you´re looking for.

Call Time Pass By Reference prohibited:
I found 3rd party code (bank payment processing) that had call time pass by reference.
It failed with no errors & no warnings until I tested the specific include with php -l  Otherwise there is no error just silent failure - and when that is deep in external code it´s a nightmare to find. To fix it: just remove the & they are no longer necessary.

This is a new setting (since 5.3.9) that can only be adjusted in the php.ini .htaccess, or httpd.conf locations. It sets the maximum number of variables (including array elements) that can be sent to the server at one time and is defauled to 1000 (they did this to prevent hash collision attacks). The gotcha here is if you have a large form with many options in it $_REQUEST or $_POST can easily surpass that quantity of elements. What makes it worse, the error you get will likely show up in your web browser as client side generated
Unsupported Compression Type
- NOT easy to diagnose. You can only find it if you check the errors_log and see things like this:  
PHP Warning:  Unknown: Input variables exceeded 1000

Hope these help you in your PHP travels.

Share this:
No Comments
You must login or register to post comments Login/Signup
RSS feed Feed Description
Subscribe to the complete News RSS news feedAll News RSS feed Complete RSS feed
Subscribe to the News RSS news feed for this category onlyTechnobloggle RSS feed for: Technobloggle
A Rich Site Summary (RSS) feed is an xml data file that provides a summary of the information contained here. It is not designed to be viewed in your browser, but instead by rss reader software. If you do not know what this means - you can safely ignore it, as it is provided for advanced users with rss reader software only.
Copyright © 1992-2024
web development: