PHP – Upgrade to PHP 5.3.x – Things to Look out for
When upgrading to php 5.3.x there will be some issues to look out for before you deploy to production, this thread is meant to contain those issues for easy reference.
PHP developers decreased the error level for not initializing timezone correctly, adjusting from strict to warning. Chances are you will start to see some warnings surrounding your date() calls. To rectify this, simply make the following change to your php.ini file:
date.timezone = America/Los_Angeles
Make sure the entry is uncommented, and set the value to whichever value you need (a list can be found @ http://us3.php.net/manual/en/timezones.php)
In PHP 5.3, the magic __toString() methods no longer allow you to pass in arguments, which makes sense on some level, but does reduce flexibility.
Just found out about this one recently. According to some comments from the PHP docs on substr, in 5.2 php internally cast the 2nd argument; start, to an int. So if you put in a string it would probably just cast to 0, and not error out. However in php 5.3, these errors started showing up, so I had to convert all substr calles to stripos calls, where it made sense of course.
PDO Bind Param – Pass by Reference
Just came across another one.
// Results in pass by reference warning $stmt->bindParam(1, $object->getValue()); // How to fix $value = $object->getValue(); $stmt->bindParam(1, $value);
- PHP – Doctrine – Soft Delete – Multiple Rows at a Time
- PHP – Doctrine – DQL – Select Subquery
- Symfony – Share Template Across Multiple Apps
- PHP – ZipArchive – 5.3.x – Weird Issue when Unlinking a File Just Added to Archive
- PHP – Symfony – Speed up CLI Commands – Do Not Load Web Plugins
- PHP – Symfony – Build Model – No yml schema found
- PHPUnit – You must not expect the generic exception class
- PHP – Correctly Cast Numeric Strings to Numeric Datatypes
- PHP – Reflection Class – Determine Parent Method Signature
- CentOS – PHP – Install Memcached (with a d) Stack