This is an old revision of the document!
PHP RFC: Remove deprecated functionality in PHP 7
- Date: 2014-09-11
- Author: Nikita Popov nikic@php.net
- Status: Under Discussion
- Targeting: PHP 7
Introduction
This RFC proposes to remove functionality which has been deprecated during the 5.x cycle.
The following extensions are deprecated:
- ext/ereg (since PHP 5.3; use ext/pcre instead)
- ext/mysql (since PHP 5.5; use ext/mysqli or ext/pdo_mysql instead) [TODO]
The following language features are deprecated:
- Assignment of
new
by reference (since PHP 5.3; use normal assignment instead) - Scoped calls of non-static methods from incompatible
$this
context (since PHP 5.6)
The following functions are deprecated:
dl
on fpm-fcgi (since PHP 5.3)set_magic_quotes_runtime
andmagic_quotes_runtime
(since PHP 5.4)set_socket_blocking
(since PHP 5.4; usestream_set_blocking
instead)mcrypt_generic_end
(since PHP 5.4; usemcrypt_generic_deinit
instead)mcrypt_ecb
,mcrypt_cbc
,mcrypt_cfb
andmcrypt_ofb
(since PHP 5.5, but documented as deprecated earlier; usemcrypt_encrypt
andmcrypt_decrypt
instead)datefmt_set_timezone_id
andIntlDateFormatter::setTimeZoneID
(since PHP 5.5; usedatefmt_set_timezone
orIntlDateFormatter::setTimeZone
instead) [TODO]
The following ini options are deprecated:
xsl.security_prefs
(since PHP 5.4; useXsltProcessor::setSecurityPrefs
instead)iconv.input_encoding
,iconv.output_encoding
,iconv.internal_encoding
,mbstring.http_input
,mbstring.http_output
andmbstring.internal_encoding
(since PHP 5.6; usephp.input_encoding
,php.internal_encoding
andphp.output_encoding
instead) [TODO]
The following miscellaneous functionality is deprecated:
#
style comments in ini files (since PHP 5.3; use;
style comments instead)- String category names in
setlocale()
(since PHP 5.3; useLC_*
constants instead) - The
$is_dst
parameter of themktime()
andgmmktime()
functions (since PHP 5.3) - Unsafe curl file uploads (since PHP 5.5; use
CurlFile
instead) preg_replace()
eval modifier (since PHP 5.5; usepreg_replace_callback
instead)PDO::PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT
driver option (since PHP 5.6; usePDO::ATTR_EMULATE_PREPARES
instead) [TODO]CN_match
andSNI_server_name
stream context option (since PHP 5.6; usepeer_name
instead) [TODO]
Patches and Tests
- Removal of ext/ereg: https://github.com/php/php-src/pull/816
- Removal of everything else not marked with
[TODO]
: https://github.com/php/php-src/pull/815
Votes
ext/ereg
The ereg extension has been deprecated since PHP 5.3. The PCRE extension should be used instead. PCRE provides better Unicode support and many more features in general. The ereg extension is effectively unmaintained currently.
If ext/ereg is removed as a bundled extension, it can still be made available as a PECL extension.
Vote: Requires simple majority.
ext/mysql
The mysql extension has been deprecated since PHP 5.5. The mysqli or PDO extension should be used instead. The deprecation has been decided in mysql_deprecation, where a discussion of the reasons behind this decision can be found.
If ext/mysql is removed as a bundled extension, it can still be made available as a PECL extension.
Vote: Requires simple majority.
Assignment of ''new'' by reference
Since PHP 5.3 assignment of new
expressions by references is deprecated. It can be replaced with a normal assignment 1):
// Instead of $obj =& new ClassName; // Write $obj = new ClassName;
Assigning the return value by reference is no longer necessary since PHP 5.0.
Vote: Requires 2/3 majority.
Scoped calls of non-static methods from incompatible ''$this'' context
Since PHP 5.5 scoped calls of non-static methods from incompatible $this
contexts are deprecated, while they already generated an E_STRICT
level error previously. The deprecation has been decided in incompat_ctx, where examples of this functionality can be found.
The RFC already specified that the functionality will be removed in the next version after deprecation, as such this vote may dropped.
Vote: Requires 2/3 majority.
Deprecated functions
The following functions are deprecated:
dl
on fpm-fcgi (since PHP 5.3)set_magic_quotes_runtime
andmagic_quotes_runtime
(since PHP 5.4)set_socket_blocking
(since PHP 5.4; usestream_set_blocking
instead)mcrypt_generic_end
(since PHP 5.4; usemcrypt_generic_deinit
instead)mcrypt_ecb
,mcrypt_cbc
,mcrypt_cfb
andmcrypt_ofb
(since PHP 5.5, but documented as deprecated earlier; usemcrypt_encrypt
andmcrypt_decrypt
instead)datefmt_set_timezone_id
andIntlDateFormatter::setTimeZoneID
(since PHP 5.5; usedatefmt_set_timezone
orIntlDateFormatter::setTimeZone
instead)
Using the dl
function in SAPIs that run more than one request has stability concerns. As such it has already been removed from most multi-request SAPIs, fpm-fcgi is the last one left.
set_magic_quotes_runtime
and magic_quotes_runtime
have been deprecated, but left as compatibility stubs for the magic quotes functionality that has been dropped in PHP 5.4. They don't do anything anymore but throw errors.
The remaining functions are just legacy aliases or quasi-aliases.
Vote: Requires simple majority.
Everything else
The following ini options are deprecated:
xsl.security_prefs
(since PHP 5.4; useXsltProcessor::setSecurityPrefs
instead)iconv.input_encoding
,iconv.output_encoding
,iconv.internal_encoding
,mbstring.http_input
,mbstring.http_output
andmbstring.internal_encoding
(since PHP 5.6; usephp.input_encoding
,php.internal_encoding
andphp.output_encoding
instead) [TODO]
The following miscellaneous functionality is deprecated:
#
style comments in ini files (since PHP 5.3; use;
style comments instead)- String category names in
setlocale()
(since PHP 5.3; useLC_*
constants instead) - The
$is_dst
parameter of themktime()
andgmmktime()
functions (since PHP 5.3) - Unsafe curl file uploads (since PHP 5.5; use
CurlFile
instead) preg_replace()
eval modifier (since PHP 5.5; usepreg_replace_callback
instead)PDO::PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT
driver option (since PHP 5.6; usePDO::ATTR_EMULATE_PREPARES
instead) [TODO]CN_match
andSNI_server_name
stream context option (since PHP 5.6; usepeer_name
instead) [TODO]
Vote: Requires simple majority