1 1. strrpos() and strripos() now use the entire string as a needle. Be aware
2 that the existing scripts may no longer work as you expect.
6 var_dump(strrpos("ABCDEF","DEF"));
7 var_dump(strrpos("ABCDEF","DAF"));
10 Will give you different results. The former returns 3 while the latter
11 returns false rather than the position of the last occurrence of 'D'.
12 The same applies to strripos().
14 2. Illegal use of string offsets causes E_ERROR instead of E_WARNING.
22 Fatal error: Cannot use string offset as an array in ... on line 1
24 3. array_merge() was changed to accept only arrays. If a non-array variable is
25 passed, a E_WARNING will be thrown for every such parameter. Be careful
26 because your code may start emitting E_WARNING out of the blue.
28 4. Be careful when porting from ext/mysql to ext/mysqli. The following
29 functions return NULL when no more data is available in the result set
30 (ext/mysql's functions return FALSE).
33 - mysqli_fetch_array()
34 - mysqli_fetch_assoc()
36 5. PATH_TRANSLATED server variable is no longer set implicitly under
37 Apache2 SAPI in contrast to the situation in PHP 4, where it is set to the
38 same value as the SCRIPT_FILENAME server variable when it is not populated
39 by Apache. This change was made to comply with the CGI specification.
40 Please refer to bug #23610 for further information.
42 6. Starting PHP 5.0.0 the T_ML_CONSTANT constant is no longer defined by the
43 ext/tokenizer extension. If error_reporting is set to E_ALL notices will
44 be produced. Instead of T_ML_CONSTANT for /* */ the T_COMMENT constant
45 is used, thus both // and /* */ are resolved as the T_COMMENT constant.
46 However the PHPDoc style comments /** */ ,which starting PHP 5 are parsed
47 by PHP, are recongnized as T_DOC_COMMENT.
49 7. $_SERVER should be populated with argc and argv if variables_order
50 includes "S". If you have specifically configured your system to not
51 create $_SERVER, then of course it shouldn't be there. The change was to
52 always make argc and argv available in the CLI version regardless of the
53 variables_order setting. As in, the CLI version will now always populate
54 the global $argc and $argv variables.
56 8. In some cases classes must be declared before used. It only happens only
57 if some of the new features of PHP 5 are used. Otherwise the behaviour is
59 Example 1 (works with no errors):
66 Example 2 (throws an error):
71 class a implements b {
76 Fatal error: Class 'a' not found in /tmp/cl.php on line 2
78 9. get_class() starting PHP 5 returns the name of the class as it was
79 declared which may lead to problems in older scripts that rely on
80 the previous behaviour - the class name is lowercased. Expect the
81 same behaviour from get_parent_class() when applicable.
86 class ExtFooBar extends FooBar{}
88 var_dump(get_class($a), get_parent_class($a));
98 ----------------------------------------------------------------------
99 Example code that will break :
101 function someMethod($p) {
102 if (get_class($p) != 'helpingclass') {
108 Possible solution is to search for get_class() and get_parent_class() in
109 all your scripts and use strtolower().
111 10. get_class_methods() returns the names of the methods of a class as they
112 declared. In PHP4 the names are all lowercased.
119 var_dump(get_class_methods("Foo"));
136 11. Assignment $this is impossible. Starting PHP 5.0.0 $this has special
137 meaning in class methods and is recognized by the PHP parser. The latter
138 will generate a parse error when assignment to $this is found
142 function assignNew($obj) {
149 echo "I was executed\n";
154 PHP Fatal error: Cannot re-assign $this in /tmp/this_ex.php on line 4