Deprecated Features
PHP Core
Implementing Serializable without
__serialize() and __unserialize()
Either only the new methods should be implemented, if no support for
PHP prior to version 7.4 is provided, or both should be implemented.
Passing null to non-nullable parameters of built-in functions
Scalar types for built-in functions are nullable by default.
This behaviour is deprecated to align with the behaviour of user-defined
functions, where scalar types need to be marked as nullable explicitly.
Implicit incompatible float to int conversions
The implicit conversion of float to int which
leads to a loss in precision is now deprecated.
This affects array keys, int type declarations in coercive mode,
and operators working on ints.
Calling a static element on a trait
Calling a static method, or accessing a
static property directly on a trait is deprecated.
Static methods and properties should only be accessed on a class using the trait.
Returning a non-array from __sleep()
Returning a value which is not an array from
__sleep() now generates a diagnostic.
Returning by reference from a void function
Such a function is contradictory, and already emits the following
E_NOTICE when called:
Only variable references should be returned by reference.
Autovivification from false
Autovivification is the process of creating a new array when
appending to a value.
Autovivification is prohibited from scalar values, false however
was an exception. This is now deprecated.
Note:
Autovivification from null and undefined values is still allowed:
ctype
Verifying non-string arguments
Passing a non-string argument is deprecated.
In the future, the argument will be interpreted as a string instead
of an ASCII codepoint.
Depending on the intended behavior, the argument should either be
cast to string or an explicit call to
chr() should be made.
All ctype_*() functions are affected.
IMAP
The NIL constant has been deprecated.
Use 0 instead.
PgSQL
Not passing the connection argument to all pgsql_*()
functions has been deprecated.