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 ofnewby reference (since PHP 5.3; use normal assignment instead)
- Scoped calls of non-static methods from incompatible$thiscontext (since PHP 5.6)
The following functions are deprecated:
- dlon fpm-fcgi (since PHP 5.3)
- set_magic_quotes_runtimeand- magic_quotes_runtime(since PHP 5.4)
- set_socket_blocking(since PHP 5.4; use- stream_set_blockinginstead)
- mcrypt_generic_end(since PHP 5.4; use- mcrypt_generic_deinitinstead)
- mcrypt_ecb,- mcrypt_cbc,- mcrypt_cfband- mcrypt_ofb(since PHP 5.5, but documented as deprecated earlier; use- mcrypt_encryptand- mcrypt_decryptinstead)
- datefmt_set_timezone_idand- IntlDateFormatter::setTimeZoneID(since PHP 5.5; use- datefmt_set_timezoneor- IntlDateFormatter::setTimeZoneinstead) [TODO]
The following ini options are deprecated:
- xsl.security_prefs(since PHP 5.4; use- XsltProcessor::setSecurityPrefsinstead)
- iconv.input_encoding,- iconv.output_encoding,- iconv.internal_encoding,- mbstring.http_input,- mbstring.http_outputand- mbstring.internal_encoding(since PHP 5.6; use- php.input_encoding,- php.internal_encodingand- php.output_encodinginstead) [TODO]
The following miscellaneous functionality is deprecated:
- #style comments in ini files (since PHP 5.3; use- ;style comments instead)
- String category names insetlocale()(since PHP 5.3; useLC_*constants instead)
- The$is_dstparameter of themktime()andgmmktime()functions (since PHP 5.3)
- Unsafe curl file uploads (since PHP 5.5; useCurlFileinstead)
- preg_replace()eval modifier (since PHP 5.5; use- preg_replace_callbackinstead)
- PDO::PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENTdriver option (since PHP 5.6; use- PDO::ATTR_EMULATE_PREPARESinstead) [TODO]
- CN_matchand- SNI_server_namestream context option (since PHP 5.6; use- peer_nameinstead) [TODO]
Patches and Tests
Note: Patches are very outdated.
- 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:
- dlon fpm-fcgi (since PHP 5.3)
- set_magic_quotes_runtimeand- magic_quotes_runtime(since PHP 5.4)
- set_socket_blocking(since PHP 5.4; use- stream_set_blockinginstead)
- mcrypt_generic_end(since PHP 5.4; use- mcrypt_generic_deinitinstead)
- mcrypt_ecb,- mcrypt_cbc,- mcrypt_cfband- mcrypt_ofb(since PHP 5.5, but documented as deprecated earlier; use- mcrypt_encryptand- mcrypt_decryptinstead)
- datefmt_set_timezone_idand- IntlDateFormatter::setTimeZoneID(since PHP 5.5; use- datefmt_set_timezoneor- IntlDateFormatter::setTimeZoneinstead)
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; use- XsltProcessor::setSecurityPrefsinstead)
- iconv.input_encoding,- iconv.output_encoding,- iconv.internal_encoding,- mbstring.http_input,- mbstring.http_outputand- mbstring.internal_encoding(since PHP 5.6; use- php.input_encoding,- php.internal_encodingand- php.output_encodinginstead) [TODO]
The following miscellaneous functionality is deprecated:
- #style comments in ini files (since PHP 5.3; use- ;style comments instead)
- String category names insetlocale()(since PHP 5.3; useLC_*constants instead)
- The$is_dstparameter of themktime()andgmmktime()functions (since PHP 5.3)
- Unsafe curl file uploads (since PHP 5.5; useCurlFileinstead)
- preg_replace()eval modifier (since PHP 5.5; use- preg_replace_callbackinstead)
- PDO::PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENTdriver option (since PHP 5.6; use- PDO::ATTR_EMULATE_PREPARESinstead) [TODO]
- CN_matchand- SNI_server_namestream context option (since PHP 5.6; use- peer_nameinstead) [TODO]
Vote: Requires simple majority