Problems with PHP 5.3.2

PHP Notice:

PHP Notice: Undefined index:

Well so what, its only a warning?

In four days this useless warning produced 116Mbytes of log files.

PHP Notice: Undefined offset:

Ah-Ha a useful warning! It looks like it has highlighed a bug. But no, the warning did not matter.

PHP Notice: Undefined variable:

PHP Notice: Cause

The default error reporting level in PHP 5.3.2 is 30719 (77FF in hex) whereas it is 2039 (7F7 hex) in PHP 4.3.7. That is, E_NOTICE (8) is now turned on by default.

PHP Notice: Solution

Clear the E_NOTICE flag.

The following code will clear it at run time (but perhaps it could be set differently in your php.ini file).

ini_set("error_reporting",(~E_NOTICE) & ini_get("error_reporting"));

PHP Deprecated: Call-time pass-by-reference has been deprecated

So you knew PHP was not a serious language, didn't you. How can one take seriously a language which removes something as the ability to pass large data structures by reference.

Call-time pass-by-reference has been deprecated - Cause

I had a function which used trim on its input. Its input was passed by reference, so the string without extra spaces was available to the caller.

Call-time pass-by-reference has been deprecated - Solution

Since this is fortunately localised to a single function, it turned out to be easy to remove the function and replace it with code that modified the data object directly.

PHP Deprecated: Function ereg() is deprecated

Function ereg() is deprecated

As of 5.3.0 PHP decided it was going to bitch until you stopped using ereg().

Function ereg() is deprecated - Solution

Use preg_match().

preg_match No ending delimiter '^' found in

Ok not quiet that easy. ereg() and preg_match() both take a search string as their first argument. However preg_match requires its regular expression to use /../ pairs.
E.g. to test for digits
preg_match("/^[0-9]+$/", $nr);

PHP Warning: It is not safe to rely on the system's timezone settings.

date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function.

system's timezone settings - Cause

PHP 5.1.0 started issuing both E_NOTICE and E_WARNING messages

system's timezone settings - Solution

At run time can use something like date_default_timezone_set('UTC'); Alternatively may be able to do something similar via your php.ini
Created 24 May 2010 by W.Langdon