Backward Incompatible Changes
Although not explicitly stated in this section,
every new function,
class, interface, enum,
or constant
may cause a redeclaration Error to be thrown.
PHP Core
exit() behavioral change
The exit() (and die()) language
constructs now behave more like a function.
This means that they can now be passed like callables,
are affected by the strict_types declare statement,
and now perform the usual type coercions instead of casting any non-integer
value to a string.
As such, passing invalid types to exit() and
die() now consistently result in a
TypeError being thrown.
Recursion during comparison
Encountering recursion during comparison now results in an
Error exception instead of a
E_ERROR fatal error.
Indirect Modification of readonly Properties
Indirect modification of readonly properties within __clone()
is no longer allowed, e.g. $ref = &$this->readonly.
This was already forbidden for readonly initialization, and was an
oversight in the "readonly reinitialization during cloning" implementation.
Type Change of Constants
The PHP_DEBUG and PHP_ZTS
constants are now of type bool.
Previously they were of type int.
Temporary Filename Length
The name of uploaded files and files created by the
tempnam() function are now 13 bytes longer.
The total length is still platform-dependent.
Removal of E_STRICT error level
The E_STRICT error level has been removed,
as it was no longer in use within the PHP engine.
The E_STRICT constant has been deprecated.
Extension Class Constants which are now Typed
The following extension class constants now declare a type on their
constants:
Resource to Object Migration
Several resources have been migrated to objects.
Return value checks using is_resource() should be
replaced with checks for false, unless specified otherwise.
New warnings and exceptions
New warnings and exceptions have been added which are triggered on
programming errors, i.e. invalid values provided as arguments.
Gettext
bind_textdomain_codeset(), textdomain(), d*gettext
now throw a ValueError if
domain is the empty string.
ODBC
odbc_fetch_row() returns false when
row is less than or equal to 0.
A warning is now emitted in this case.
XMLWriter
Passing a string containing null bytes previously emitted a
warning and now throws a ValueError.
Date
number symbols in relative formats
once again accept multiple signs, e.g. +-2.
GMP
The GMP class is now final and cannot be extended
anymore.
MBString
As of PHP 8.3.2, on invalid strings (those with encoding errors),
mb_substr() and mb_strstr() interpret
character indices in the same manner as most other mbstring functions.
This means that character indices returned by mb_strpos()
can be passed to mb_substr().
For SJIS-mac (MacJapanese) strings, those character
indices refer to the indices of the Unicode codepoints which are produced
when the string is converted to Unicode, which differ from the character
indices for the SJIS-mac characters that convert to a
sequence of several codepoints.
MySQLnd
The error code reported for MySQL server wait timeouts has been changed from
2006 to 4031 for MySQL server
versions 8.0.24 and above.
PCRE
The bundled pcre2lib has been updated to version 10.44.
As a consequence, this means {,3} is now recognized
as a quantifier instead of as text.
Furthermore, the meaning of some character classes in UCP mode has changed.
Consult the » PCRE2 Changelog
for a full changelog.
PDO_FIREBIRD
The PDO::ATTR_AUTOCOMMIT attribute now act as
boolean attributes instead of integer attributes.
Thus setting the attribute via PDO::setAttribute()
and retrieving it via PDO::getAttribute() expects
and or return a bool.
The extension now exposes some Firebird C++ APIs,
therefore building this extension now requires a C++ compiler.
Moreover, the extension must now be compiled against fbclient 3.0 or higher.
PDO_PGSQL
The DSN's credentials, when set, are given priority over their PDO
constructor counterparts, being closer to the documentation states.
SOAP
SoapClient::$typemap is now an array
rather than a resource.
Checks using is_resource() (i.e.
is_resource($client->typemap)) should be
replaced with checks for null (i.e. $client->typemap !== null).
The SOAP extension gained an optional dependency on the
session extension.
If PHP is built without the session extension and with the
--enable-rtld-now configure flag enabled,
startup errors will now occur if the SOAP
extension is also used.
To solve this either don't use rtld-now or load the session extension.
Tidy
Failures in the constructor now throw exceptions rather than emitting
warnings and having a broken object.
XML
The xml_set_*_handler
functions now declare and check for an effective
signature of callable|string|null for the
handler parameters.
Moreover, values of type string that correspond to method names,
of object set with xml_set_object() are now checked to
see if the method exists on the class of the previously passed object.
This means that xml_set_object() must now always be
called prior to setting method names as callables.
Passing an empty string to disable the handler is still allowed,
but deprecated.
However, as xml_set_object() and passing
non-callable strings is deprecated.
It is recommended to change such instances with a callable
referring to the method directly.