Backward incompatible changes
Convert numeric keys in object and array casts
Numeric keys are now better handled when casting arrays to objects and
objects to arrays (either from explicit casting or by
settype()).
This means that integer (or stringy integer) keys from arrays being casted
to objects are now accessible:
And integer (or stringy integer) keys from objects being casted to arrays
are now accessible:
Previously, passing null to the get_class() function
would output the name of the enclosing class. This behaviour has now been
removed, where an E_WARNING will be output instead. To
achieve the same behaviour as before, the argument should simply be omitted.
Warn when counting non-countable types
An E_WARNING will now be emitted when attempting to
count() non-countable types (this includes the
sizeof() alias function).
Move ext/hash from resources to objects
As part of the long-term migration away from resources, the Hash
extension has been updated to use objects instead of resources. The change should be
seamless for PHP developers, except for where
is_resource() checks have been made (which will need
updating to is_object() instead).
Improve SSL/TLS defaults
The following changes to the defaults have been made:
-
tls:// now defaults to TLSv1.0 or TLSv1.1 or TLSv1.2
-
ssl:// an alias of tls://
-
STREAM_CRYPTO_METHOD_TLS_* constants default to TLSv1.0
or TLSv1.1 + TLSv1.2, instead of TLSv1.0 only
gettype() return value on closed resources
Previously, using gettype() on a closed resource would
return a string of "unknown type". Now, a string of
"resource (closed)" will be returned.
Promote the error level of undefined constants
Unqualified references to undefined constants will now generate an
E_WARNING (instead of an E_NOTICE).
In the next major version of PHP, they will generate
Error exceptions.
Windows support
The officially supported, minimum Windows versions are now Windows 7/Server
2008 R2.
Checks on default property values of traits
Compatibility checks upon default trait property values will no longer
perform casting.
object for class names
The object name was previously soft-reserved in PHP 7.0.
This is now hard-reserved, prohibiting it from being used as a class, trait,
or interface name.
NetWare support
Support for NetWare has now been removed.
array_unique() with SORT_STRING
builds the returned array by adding the unique elements to a new array;
formerly, it was a copy of the input from which the non-unique elements
were removed.
Both hold the same elements under the same keys, but if the element with
the largest integer key is among those removed, the index generated for an
element appended to the returned array differs from the one the input
would have generated.
bcmod() changes with floats
The bcmod() function no longer truncates fractional
numbers to integers. As such, its behavior now follows
fmod(), rather than the % operator.
For example bcmod('4', '3.5') now returns
0.5 instead of 1.
Sequences generated by rand() and
mt_rand() for a specific seed may differ from PHP 7.1 on
64-bit machines (due to the fixing of a modulo bias bug in the
implementation).
The sql.safe_mode ini setting has now been removed.
Incoming Cookies
As of PHP 7.2.34, the names of incoming cookies are no
longer url-decoded for security reasons.