Deprecated FeaturesPHP CoreChanges to user output handler
Trying to produce output (e.g. with echo) within
a user output handler is deprecated.
The deprecation warning will bypass the handler producing the output to
ensure it is visible; if there are nested output handlers the next
one will still be used.
Non-canonical cast names
Non-canonical cast names (boolean),
(integer), (double),
and (binary) have been deprecated,
use (bool), (int),
(float), and (string) respectively.
Terminating case statements with a semicolon
Terminating case statements with a semicolon instead of a colon has
been deprecated.
The backtick operator
The backtick operator
as an alias for shell_exec has been deprecated.
Returning null from __debugInfo()
Returning &null; from
__debugInfo()
has been deprecated. Return an empty array instead.
report_memleaks INI directive
The report_memleaks INI directive
has been deprecated.
Constant redeclaration
Constant redeclaration has been deprecated.
Note that this already generated a warning and will continue to do so.
Closure binding issues
The following closure binding issues, which already emit an
E_WARNING, are now deprecated:
Binding an instance to a static closure.Binding methods to objects that are not instances of the class
(or subclass) that the method is defined.Unbinding $this from a method.Unbinding $this from a closure that uses `$this`.Binding a closure to the scope of an internal class.Rebinding the scope of a closure created from a function or method.__sleep() and __wakeup() magic methods
The __sleep() and
__wakeup() magic methods
have been soft-deprecated.
The __serialize() and
__unserialize() magic
methods should be used instead, or at the same time if compatibility
with PHP 7 is required.
Using null as an array offset
Using &null; as an array offset or when calling array_key_exists
is now deprecated. Instead an empty string should be used.
Incrementing non-numeric strings
Incrementing non-numeric strings is now deprecated.
Instead the str_increment function should be used.
register_argc_argv INI directive
Deriving $_SERVER['argc'] and $_SERVER['argv']
from the query string for non-CLI SAPIs has been deprecated.
Configure register_argc_argv=0 and switch to either
$_GET or $_SERVER['QUERY_STRING']
to access the information, after verifying that the usage is safe.
cURL
The curl_close function has been deprecated,
as CurlHandle objects are freed automatically.
The curl_share_close function has been deprecated,
as CurlShareHandle objects are freed automatically.
Date
The DATE_RFC7231 and
DateTimeInterface::RFC7231 constants have been deprecated.
This is because the associated timezone is ignored and always uses GMT.
FileInfo
The finfo_close function has been deprecated.
As finfo objects are freed automatically.
The context parameter of the
finfo_buffer function has been deprecated
as it is ignored.
GD
The imagedestroy function has been deprecated,
as GdImage objects are freed automatically.
Hash
The MHASH_* constants have
been deprecated.
Intl
The intl.error_level INI setting
has been deprecated.
Errors should either be checked manually or exceptions should be enabled by
using the intl.use_exceptions
INI setting.
LDAP
Specific Oracle Instant Client calls and constants have been deprecated.
List of affected calls:
ldap_connect with wallet supportldap_connect_wallet
List of affected constants:
GSLC_SSL_NO_UATHGSLC_SSL_ONEWAY_UATHGSLC_SSL_TWOWAY_UATHMySQLi
The mysqli_execute alias function has been deprecated.
Use mysqli_stmt_execute instead.
OpenSSL
The key_length parameter for
openssl_pkey_derive has been deprecated.
This is because it is either ignored, or truncates the key, which can be
a security vulnerability.
PDO
The "uri:" DSN scheme has been deprecated due to security concerns with
DSNs coming from remote URIs.
Driver specific constants in the PDO class have been deprecated.
List of affected constants and their replacement:
PDO::DBLIB_ATTR_CONNECTION_TIMEOUT => Pdo\Dblib::ATTR_CONNECTION_TIMEOUTPDO::DBLIB_ATTR_QUERY_TIMEOUT => Pdo\Dblib::ATTR_QUERY_TIMEOUTPDO::DBLIB_ATTR_STRINGIFY_UNIQUEIDENTIFIER => Pdo\Dblib::ATTR_STRINGIFY_UNIQUEIDENTIFIERPDO::DBLIB_ATTR_VERSION => Pdo\Dblib::ATTR_VERSIONPDO::DBLIB_ATTR_TDS_VERSION => Pdo\Dblib::ATTR_TDS_VERSIONPDO::DBLIB_ATTR_SKIP_EMPTY_ROWSETS => Pdo\Dblib::ATTR_SKIP_EMPTY_ROWSETSPDO::DBLIB_ATTR_DATETIME_CONVERT => Pdo\Dblib::ATTR_DATETIME_CONVERTPDO::FB_ATTR_DATE_FORMAT => Pdo\Firebird::ATTR_DATE_FORMATPDO::FB_ATTR_TIME_FORMAT => Pdo\Firebird::ATTR_TIME_FORMATPDO::FB_ATTR_TIMESTAMP_FORMAT => Pdo\Firebird::ATTR_TIMESTAMP_FORMATPDO::MYSQL_ATTR_USE_BUFFERED_QUERY => Pdo\Mysql::ATTR_USE_BUFFERED_QUERYPDO::MYSQL_ATTR_LOCAL_INFILE => Pdo\Mysql::ATTR_LOCAL_INFILEPDO::MYSQL_ATTR_LOCAL_INFILE_DIRECTORY => Pdo\Mysql::ATTR_LOCAL_INFILE_DIRECTORYPDO::MYSQL_ATTR_INIT_COMMAND => Pdo\Mysql::ATTR_INIT_COMMANDPDO::MYSQL_ATTR_MAX_BUFFER_SIZE => Pdo\Mysql::ATTR_MAX_BUFFER_SIZEPDO::MYSQL_ATTR_READ_DEFAULT_FILE => Pdo\Mysql::ATTR_READ_DEFAULT_FILEPDO::MYSQL_ATTR_READ_DEFAULT_GROUP => Pdo\Mysql::ATTR_READ_DEFAULT_GROUPPDO::MYSQL_ATTR_COMPRESS => Pdo\Mysql::ATTR_COMPRESSPDO::MYSQL_ATTR_DIRECT_QUERY => Pdo\Mysql::ATTR_DIRECT_QUERYPDO::MYSQL_ATTR_FOUND_ROWS => Pdo\Mysql::ATTR_FOUND_ROWSPDO::MYSQL_ATTR_IGNORE_SPACE => Pdo\Mysql::ATTR_IGNORE_SPACEPDO::MYSQL_ATTR_SSL_KEY => Pdo\Mysql::ATTR_SSL_KEYPDO::MYSQL_ATTR_SSL_CERT => Pdo\Mysql::ATTR_SSL_CERTPDO::MYSQL_ATTR_SSL_CA => Pdo\Mysql::ATTR_SSL_CAPDO::MYSQL_ATTR_SSL_CAPATH => Pdo\Mysql::ATTR_SSL_CAPATHPDO::MYSQL_ATTR_SSL_CIPHER => Pdo\Mysql::ATTR_SSL_CIPHERPDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => Pdo\Mysql::ATTR_SSL_VERIFY_SERVER_CERTPDO::MYSQL_ATTR_SERVER_PUBLIC_KEY => Pdo\Mysql::ATTR_SERVER_PUBLIC_KEYPDO::MYSQL_ATTR_MULTI_STATEMENTS => Pdo\Mysql::ATTR_MULTI_STATEMENTSPDO::ODBC_ATTR_USE_CURSOR_LIBRARY => Pdo\Odbc::ATTR_USE_CURSOR_LIBRARYPDO::ODBC_ATTR_ASSUME_UTF8 => Pdo\Odbc::ATTR_ASSUME_UTF8PDO::ODBC_SQL_USE_IF_NEEDED => Pdo\Odbc::SQL_USE_IF_NEEDEDPDO::ODBC_SQL_USE_DRIVER => Pdo\Odbc::SQL_USE_DRIVERPDO::ODBC_SQL_USE_ODBC => Pdo\Odbc::SQL_USE_ODBCPDO::PGSQL_ATTR_DISABLE_PREPARES => Pdo\Pgsql::ATTR_DISABLE_PREPARESPDO::SQLITE_ATTR_EXTENDED_RESULT_CODES => Pdo\Sqlite::ATTR_EXTENDED_RESULT_CODESPDO::SQLITE_ATTR_OPEN_FLAGS => Pdo\Sqlite::ATTR_OPEN_FLAGSPDO::SQLITE_ATTR_READONLY_STATEMENT => Pdo\Sqlite::ATTR_READONLY_STATEMENTPDO::SQLITE_DETERMINISTIC => Pdo\Sqlite::DETERMINISTICPDO::SQLITE_OPEN_READONLY => Pdo\Sqlite::OPEN_READONLYPDO::SQLITE_OPEN_READWRITE => Pdo\Sqlite::OPEN_READWRITEPDO::SQLITE_OPEN_CREATE => Pdo\Sqlite::OPEN_CREATE
Driver specific methods in the PDO class have been deprecated.
List of affected methods and their replacement:
PDO::pgsqlCopyFromArray => Pdo\Pgsql::copyFromArrayPDO::pgsqlCopyFromFile => Pdo\Pgsql::copyFromFilePDO::pgsqlCopyToArray => Pdo\Pgsql::copyToArrayPDO::pgsqlCopyToFile => Pdo\Pgsql::copyToFilePDO::pgsqlGetNotify => Pdo\Pgsql::getNotifyPDO::pgsqlGetPid => Pdo\Pgsql::getPidPDO::pgsqlLOBCreate => Pdo\Pgsql::lobCreatePDO::pgsqlLOBOpen => Pdo\Pgsql::lobOpenPDO::pgsqlLOBUnlink => Pdo\Pgsql::lobUnlinkPDO::sqliteCreateAggregate => Pdo\Sqlite::createAggregatePDO::sqliteCreateCollation => Pdo\Sqlite::createCollationPDO::sqliteCreateFunction => Pdo\Sqlite::createFunctionPDO_PGSQL
Constants related to transaction states have been deprecated as this feature is unavailable with PDO:
PDO::PGSQL_TRANSACTION_IDLEPDO::PGSQL_TRANSACTION_ACTIVEPDO::PGSQL_TRANSACTION_INTRANSPDO::PGSQL_TRANSACTION_INERRORPDO::PGSQL_TRANSACTION_UNKNOWNReflection
The setAccessible() methods of various Reflection objects have been
deprecated, as those no longer have an effect.
Calling ReflectionClass::getConstant for constants
that do not exist has been deprecated.
Calling ReflectionProperty::getDefaultValue for
properties without default values has been deprecated.
SPL
Unregistering all autoloaders by passing the
spl_autoload_call function as a callback argument to
spl_autoload_unregister has been deprecated.
Instead if this is needed, one should iterate over the return value of
spl_autoload_functions and call
spl_autoload_unregister on each value.
The SplObjectStorage::contains,
SplObjectStorage::attach, and
SplObjectStorage::detach methods have been deprecated
in favour of SplObjectStorage::offsetExists,
SplObjectStorage::offsetSet, and
SplObjectStorage::offsetUnset respectively.
Using ArrayObject and
ArrayIterator with objects has been deprecated.
Standard
The socket_set_timeout alias function has been deprecated.
Use stream_set_timeout instead.
Passing &null; to readdir,
rewinddir, and closedir
to use the last opened directory has been deprecated.
Provide the last opened directory explicitly instead.
Passing integers outside the interval [0, 255] to chr
is now deprecated.
This is because a byte can only hold a value within this interval.
Passing a string which is not a single byte to ord
is now deprecated, this is indicative of a bug.
The locally predefined variable
$http_response_header
is deprecated. Instead one should call the
http_get_last_response_headers function.
XML
The xml_parser_free function has been deprecated,
as XMLParser objects are freed automatically.