Although most existing PHP 5 code should work without changes, please take note of some backward incompatible changes:
FALSE
. set_magic_quotes_runtime() raises an
E_CORE_ERROR
level error on trying to enable Magic quotes.
break 1 + foo() * $bar;
).
Static arguments still work, such as break 2;
. As a side effect of this change
break 0;
and continue 0;
are no longer allowed.
UTF-8
,
instead of ISO-8859-1
. Note that changing your output
charset via the default_charset
configuration setting does not affect htmlspecialchars/htmlentities unless
you are passing "" (an empty string) as the encoding parameter to your
htmlspecialchars()/htmlentities()/html_entity_decode() calls.
Generally we do not recommend doing this because you should be able to
change your output charset without affecting the runtime charset used by
these functions. The safest approach is to explicitly set the charset on
each call to htmlspecialchars(),
htmlentities() and html_entity_decode().
E_WARNING
.
$a['foo']
where $a is a string - now return
false on isset() and true on empty(), and produce a E_WARNING
if you try to use them. Offsets of types double, bool and null produce a E_NOTICE
. Numeric strings
(e.g. $a['2']
) still work as before. Note that offsets like '12.3'
and '5 foobar'
are considered non-numeric and produce a E_WARNING
, but are converted
to 12 and 5 respectively, for backward compatibility reasons.
Note: Following code returns different result.
$str='abc';var_dump(isset($str['x'])); // false for PHP 5.4 or later, but true for 5.3 or less
E_NOTICE
level
error, but the result of the cast will still be the string "Array"
.
NULL
, FALSE
, or an empty string into an object by adding a property
will now emit an E_WARNING
level error, instead of E_STRICT
.
function foo($_GET, $_POST) {}
.
array()
instead of FALSE
when two empty arrays are provided as parameters.
E_STRICT
level error is emitted.
erase
to integer
flags
. Note that code that explicitly set
erase
to FALSE
will no longer behave as expected
in PHP 5.4: please follow
this example to write
code that is compatible with PHP 5.3 and 5.4.
The following keywords are now reserved, and may not be used as names by functions, classes, etc.
The following functions have been removed from PHP: