Both sides previous revisionPrevious revisionNext revision | Previous revision |
rfc:remove_deprecated_functionality_in_php7 [2014/12/31 17:04] – nikic | rfc:remove_deprecated_functionality_in_php7 [2017/09/22 13:28] (current) – external edit 127.0.0.1 |
---|
* Date: 2014-09-11 | * Date: 2014-09-11 |
* Author: Nikita Popov <nikic@php.net> | * Author: Nikita Popov <nikic@php.net> |
* Status: Under Discussion | * Status: Implemented (PHP 7.0) |
* Targeting: PHP 7 | * Targeting: PHP 7 |
* Discussion: http://markmail.org/message/vcladdh5sciqjpvg | * Discussion: http://markmail.org/message/vcladdh5sciqjpvg |
The following extensions are deprecated: | The following extensions are deprecated: |
| |
* ext/ereg (since PHP 5.3; use ext/pcre instead) | * ext/ereg (since PHP 5.3; use ext/pcre instead) [[https://github.com/php/php-src/commit/fea9a6fc7702c53df5e9f4c16857dc921d8b5997|REMOVED]] ([[http://pecl.php.net/package/ereg|PECL extension]]) |
* ext/mysql (since PHP 5.5; use ext/mysqli or ext/pdo_mysql instead) [TODO] | * ext/mysql (since PHP 5.5; use ext/mysqli or ext/pdo_mysql instead) [[https://github.com/php/php-src/commit/fd1578c196575c7e120a84ee030bb87c14a199b0|REMOVED]] ([[http://pecl.php.net/package/mysql|PECL extension]]) |
| |
The following language features are deprecated: | The following language features are deprecated: |
| |
* Assignment of ''new'' by reference (since PHP 5.3; use normal assignment instead) | * Assignment of ''new'' by reference (since PHP 5.3; use normal assignment instead) [[https://github.com/php/php-src/commit/4d3e4d3bf994739681613f9061d056e10f731b65|REMOVED]] |
* Scoped calls of non-static methods from incompatible ''$this'' context (since PHP 5.6) | * Scoped calls of non-static methods from incompatible ''$this'' context (since PHP 5.6) [[https://github.com/php/php-src/commit/085774997b591c2babbb623fe7102ce2c77bc9fb|REMOVED]] |
| |
The following functions are deprecated: | The following functions are deprecated: |
| |
* ''dl'' on fpm-fcgi (since PHP 5.3) | * ''dl'' on fpm-fcgi (since PHP 5.3) [[https://github.com/php/php-src/commit/e05993dfa20e934ba99ccd5b2b944a7759126f58|REMOVED]] |
* ''set_magic_quotes_runtime'' and ''magic_quotes_runtime'' (since PHP 5.4) | * ''set_magic_quotes_runtime'' and ''magic_quotes_runtime'' (since PHP 5.4) [[https://github.com/php/php-src/commit/a60efc5e11b65083ef4cc8a132df620e1642dd76|REMOVED]] |
* ''set_socket_blocking'' (since PHP 5.4; use ''stream_set_blocking'' instead) | * ''set_socket_blocking'' (since PHP 5.4; use ''stream_set_blocking'' instead) [[https://github.com/php/php-src/commit/ca11bc0325496bef94d4417f300e323040fb11db|REMOVED]] |
* ''mcrypt_generic_end'' (since PHP 5.4; use ''mcrypt_generic_deinit'' instead) | * ''mcrypt_generic_end'' (since PHP 5.4; use ''mcrypt_generic_deinit'' instead) [[https://github.com/php/php-src/commit/c488a4570197240af8e05eaab95c0b308c2246d8|REMOVED]] |
* ''mcrypt_ecb'', ''mcrypt_cbc'', ''mcrypt_cfb'' and ''mcrypt_ofb'' (since PHP 5.5, but documented as deprecated earlier; use ''mcrypt_encrypt'' and ''mcrypt_decrypt'' instead) | * ''mcrypt_ecb'', ''mcrypt_cbc'', ''mcrypt_cfb'' and ''mcrypt_ofb'' (since PHP 5.5, but documented as deprecated earlier; use ''mcrypt_encrypt'' and ''mcrypt_decrypt'' instead) [[https://github.com/php/php-src/commit/7810659cc372b17d48a7f0a799cc1509471916a1|REMOVED]] |
* ''datefmt_set_timezone_id'' and ''IntlDateFormatter::setTimeZoneID'' (since PHP 5.5; use ''datefmt_set_timezone'' or ''IntlDateFormatter::setTimeZone'' instead) [TODO] | * ''datefmt_set_timezone_id'' and ''IntlDateFormatter::setTimeZoneID'' (since PHP 5.5; use ''datefmt_set_timezone'' or ''IntlDateFormatter::setTimeZone'' instead) [[https://github.com/php/php-src/commit/cf0ffa8e4c0bb92bfae60963a6e4c0dea00bd003|REMOVED]] |
| |
The following ini options are deprecated: | The following ini options are deprecated: |
| |
* ''xsl.security_prefs'' (since PHP 5.4; use ''XsltProcessor::setSecurityPrefs'' instead) | * ''xsl.security_prefs'' (since PHP 5.4; use ''XsltProcessor::setSecurityPrefs'' instead) [[https://github.com/php/php-src/commit/a81e65a5018a04379914c605f7a9c69ac8941600|REMOVED]] |
* ''iconv.input_encoding'', ''iconv.output_encoding'', ''iconv.internal_encoding'', ''mbstring.http_input'', ''mbstring.http_output'' and ''mbstring.internal_encoding'' (since PHP 5.6; use ''php.input_encoding'', ''php.internal_encoding'' and ''php.output_encoding'' instead) [TODO] | * ''iconv.input_encoding'', ''iconv.output_encoding'', ''iconv.internal_encoding'', ''mbstring.http_input'', ''mbstring.http_output'' and ''mbstring.internal_encoding'' (since PHP 5.6; use ''php.input_encoding'', ''php.internal_encoding'' and ''php.output_encoding'' instead) [TODO] |
| |
The following miscellaneous functionality is deprecated: | The following miscellaneous functionality is deprecated: |
| |
* ''#'' style comments in ini files (since PHP 5.3; use '';'' style comments instead) | * The ''$is_dst'' parameter of the ''mktime()'' and ''gmmktime()'' functions (since PHP 5.1) [[https://github.com/php/php-src/commit/9c5eaac18b65038cc377c7335b32889b892cf1fc|REMOVED]] |
* String category names in ''setlocale()'' (since PHP 5.3; use ''LC_*'' constants instead) | * ''#'' style comments in ini files (since PHP 5.3; use '';'' style comments instead) [[https://github.com/php/php-src/commit/83391b5518619cce7d2a1baf5a4434b1690a33d1|REMOVED]] |
* The ''$is_dst'' parameter of the ''mktime()'' and ''gmmktime()'' functions (since PHP 5.3) | * String category names in ''setlocale()'' (since PHP 5.3; use ''LC_*'' constants instead) [[https://github.com/php/php-src/commit/4c115b6b71e31a289d84f72f8664943497b9ee31|REMOVED]] |
* Unsafe curl file uploads (since PHP 5.5; use ''CurlFile'' instead) | * Unsafe curl file uploads (since PHP 5.5; use ''CurlFile'' instead) [[https://github.com/php/php-src/commit/b5184ef33606c808b66c4b2738c80376c95de65b|REMOVED]] |
* ''preg_replace()'' eval modifier (since PHP 5.5; use ''preg_replace_callback'' instead) | * ''preg_replace()'' eval modifier (since PHP 5.5; use ''preg_replace_callback'' instead) [[https://github.com/php/php-src/commit/cb9c99ebd075d1d4fae0cbf5df54ca14c4071584|REMOVED]] |
* ''PDO::PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT'' driver option (since PHP 5.6; use ''PDO::ATTR_EMULATE_PREPARES'' instead) [TODO] | * ''PDO::PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT'' driver option (since PHP 5.6; use ''PDO::ATTR_EMULATE_PREPARES'' instead) [[https://github.com/php/php-src/commit/4694e1c02039114915704f0206f1ffb7a0efe4ad|REMOVED]] |
* ''CN_match'' and ''SNI_server_name'' stream context option (since PHP 5.6; use ''peer_name'' instead) [TODO] | * ''CN_match'' and ''SNI_server_name'' stream context option (since PHP 5.6; use ''peer_name'' instead) [[https://github.com/php/php-src/commit/2a87a42cd431ea8008ce24db6e57948052ff805d|REMOVED]] |
| |
===== Patches and Tests ===== | ===== Patches and Tests ===== |
| |
Note: Patches are very outdated. | Note: Patches are very outdated. I'll update them after the votes. |
| |
* Removal of ext/ereg: https://github.com/php/php-src/pull/816 | * Removal of ext/ereg: https://github.com/php/php-src/pull/816 |
| |
===== Votes ===== | ===== Votes ===== |
| |
| Voting started on 2015-01-02 and ended on 2015-01-16. All votes refer to PHP 7. |
| |
| All removals have been accepted. |
| |
==== ext/ereg ==== | ==== ext/ereg ==== |
| |
Vote: Requires simple majority. | Vote: Requires simple majority. |
| |
| <doodle title="Unbundle the ext/ereg extension?" auth="nikic" voteType="single" closed="true"> |
| * Yes |
| * No |
| </doodle> |
| |
==== ext/mysql ==== | ==== ext/mysql ==== |
Vote: Requires simple majority. | Vote: Requires simple majority. |
| |
==== Assignment of ''new'' by reference ==== | <doodle title="Unbundle the ext/mysql extension?" auth="nikic" voteType="single" closed="true"> |
| * Yes |
| * No |
| </doodle> |
| |
| ==== 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 ((reference-breaking notwithstanding)): | Since PHP 5.3 assignment of ''new'' expressions by references is deprecated. It can be replaced with a normal assignment ((reference-breaking notwithstanding)): |
Vote: Requires 2/3 majority. | Vote: Requires 2/3 majority. |
| |
==== Scoped calls of non-static methods from incompatible ''$this'' context ==== | <doodle title="Remove assignment of new by reference?" auth="nikic" voteType="single" closed="true"> |
| * Yes |
| * No |
| </doodle> |
| |
| ==== 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 [[rfc/incompat_ctx]], where examples of this functionality can be found. | 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 [[rfc/incompat_ctx]], where examples of this functionality can be found. |
Vote: Requires 2/3 majority. | Vote: Requires 2/3 majority. |
| |
==== ''#'' style comments in ini files ==== | <doodle title="Remove support for calls from incompatible context?" auth="nikic" voteType="single" closed="true"> |
| * Yes |
| * No |
| </doodle> |
| |
The standard ini file format uses '';'' to denote comments. However PHP [[http://markmail.org/message/xsvd3eyrijlpnfl2|accidentially (?)]] also supported comments starting with ''#'' in some circumstances. When this was discovered in PHP 5.3, they were deprecated. | ==== dl() on fpm-fcgi ==== |
| |
| Use of ''dl()'' in the fpm-fcgi SAPI is deprecated since PHP 5.3. |
| |
| Using the ''dl()'' function in SAPIs that run more than one request has stability concerns. As such it has already been removed from other multi-request SAPIs, fpm-fcgi is the last one left. |
| |
Vote: Requires simple majority. | Vote: Requires simple majority. |
| |
| <doodle title="Remove dl() in fpm-fcgi SAPI?" auth="nikic" voteType="single" closed="true"> |
| * Yes |
| * No |
| </doodle> |
| |
| ==== set_magic_quotes_runtime() and magic_quotes_runtime() ==== |
| |
| Support for magic quotes has been removed in PHP 5.4. To facilitate backwards compatibility the ''set_magic_quotes_runtime()'' and ''magic_quotes_runtime()'' functions have been retained, but deprecated. Attempting to enable magic quotes using them will result in a fatal error. |
| |
| Vote: Requires simple majority. |
| |
| <doodle title="Remove (set_)magic_quotes_runtime() functions?" auth="nikic" voteType="single" closed="true"> |
| * Yes |
| * No |
| </doodle> |
| |
| ==== Other deprecated functions ==== |
| |
| The following functions are deprecated: |
| |
| * ''set_socket_blocking'' (since PHP 5.4; use ''stream_set_blocking'' instead) |
| * ''mcrypt_generic_end'' (since PHP 5.4; use ''mcrypt_generic_deinit'' instead) |
| * ''mcrypt_ecb'', ''mcrypt_cbc'', ''mcrypt_cfb'' and ''mcrypt_ofb'' (since PHP 5.5, but documented as deprecated earlier; use ''mcrypt_encrypt'' and ''mcrypt_decrypt'' instead) |
| * ''datefmt_set_timezone_id'' and ''IntlDateFormatter::setTimeZoneID'' (since PHP 5.5; use ''datefmt_set_timezone'' or ''IntlDateFormatter::setTimeZone'' instead) |
| |
| |
| These functions are just legacy aliases or quasi-aliases. |
| |
| Vote: Requires simple majority. |
| |
| <doodle title="Remove listed deprecated functions?" auth="nikic" voteType="single" closed="true"> |
| * Yes |
| * No |
| </doodle> |
| |
==== xsl.security_prefs ini directive ==== | ==== xsl.security_prefs ini directive ==== |
| |
Vote: Requires simple majority. | Vote: Requires simple majority. |
| |
| <doodle title="Remove xsl.security_prefs ini directive?" auth="nikic" voteType="single" closed="true"> |
| * Yes |
| * No |
| </doodle> |
| |
==== iconv and mbstring encoding ini directives ==== | ==== iconv and mbstring encoding ini directives ==== |
Vote: Requires simple majority. | Vote: Requires simple majority. |
| |
==== CN_match and SNI_server_name stream context options ==== | <doodle title="Remove extension specific encoding ini directives?" auth="nikic" voteType="single" closed="true"> |
| * Yes |
| * No |
| </doodle> |
| |
Since PHP 5.6 it is no longer necessary to explicitly specify the host name using the ''CN_match'' and ''SNI_server_name'' stream context options, it will be determined automatically instead. It is possible to manually specify a host name using the ''peer_name'' context option, which covers both CN and SNI. The old, separate options have been deprecated. | ==== $is_dst parameter of the mktime() and gmmktime() functions ==== |
| |
| The ''$is_dst'' parameter of the ''mktime()'' and ''gmmktime()'' functions has been deprecated in PHP 5.1. Instead the timezone handling functions should be used. |
| |
Vote: Requires simple majority. | Vote: Requires simple majority. |
| |
==== Deprecated functions ==== | <doodle title="Remove $is_dst parameter of the mktime() and gmmktime() functions?" auth="nikic" voteType="single" closed="true"> |
| * Yes |
| * No |
| </doodle> |
| |
The following functions are deprecated: | ==== #-style comments in ini files ==== |
| |
* ''dl'' on fpm-fcgi (since PHP 5.3) | The standard ini file format uses '';'' to denote comments. However PHP [[http://markmail.org/message/xsvd3eyrijlpnfl2|accidentially (?)]] also supported comments starting with ''#'' in some circumstances. When this was discovered in PHP 5.3, they were deprecated. |
* ''set_magic_quotes_runtime'' and ''magic_quotes_runtime'' (since PHP 5.4) | |
* ''set_socket_blocking'' (since PHP 5.4; use ''stream_set_blocking'' instead) | |
* ''mcrypt_generic_end'' (since PHP 5.4; use ''mcrypt_generic_deinit'' instead) | |
* ''mcrypt_ecb'', ''mcrypt_cbc'', ''mcrypt_cfb'' and ''mcrypt_ofb'' (since PHP 5.5, but documented as deprecated earlier; use ''mcrypt_encrypt'' and ''mcrypt_decrypt'' instead) | |
* ''datefmt_set_timezone_id'' and ''IntlDateFormatter::setTimeZoneID'' (since PHP 5.5; use ''datefmt_set_timezone'' or ''IntlDateFormatter::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. | Vote: Requires simple majority. |
| |
''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. | <doodle title="Remove support for #-style comments in ini files?" auth="nikic" voteType="single" closed="true"> |
| * Yes |
| * No |
| </doodle> |
| |
The remaining functions are just legacy aliases or quasi-aliases. | ==== String category names in setlocale() ==== |
| |
| Since PHP 5.3 the use of string category names in ''setlocale()'' is deprecated and the corresponding ''LC_*'' constants should be used instead: |
| |
| <code php> |
| // Instead of |
| setlocale('LC_ALL', 'de_DE'); |
| // Write |
| setlocale(LC_ALL, 'de_DE'); |
| </code> |
| |
Vote: Requires simple majority. | Vote: Requires simple majority. |
| |
==== Miscellaneous ==== | <doodle title="Disallow string category names in setlocale()?" auth="nikic" voteType="single" closed="true"> |
| * Yes |
| * No |
| </doodle> |
| |
The following miscellaneous functionality is deprecated: | ==== Unsafe curl file uploads ==== |
| |
* String category names in ''setlocale()'' (since PHP 5.3; use ''LC_*'' constants instead) | As part of the [[rfc/curl-file-upload]] RFC, the ''CURLOPT_SAFE_UPLOAD'' curl option has been introduced in PHP 5.5 to control whether the use of ''CURLFile'' is required to upload files. Since PHP 5.6 the option defaults to ''true''. |
* The ''$is_dst'' parameter of the ''mktime()'' and ''gmmktime()'' functions (since PHP 5.3) | |
* Unsafe curl file uploads (since PHP 5.5; use ''CurlFile'' instead; see also [[https://wiki.php.net/rfc/curl-file-upload]]) | For compatibility purposes the option will not be removed altogether, only the ability to set it to ''false'' is removed. |
* ''preg_replace()'' eval modifier (since PHP 5.5; use ''preg_replace_callback'' instead; see also [[https://wiki.php.net/rfc/remove_preg_replace_eval_modifier]]) | |
* ''PDO::PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT'' driver option (since PHP 5.6; use ''PDO::ATTR_EMULATE_PREPARES'' instead) | Vote: Requires simple majority. |
| |
| <doodle title="Disallow enabling unsafe curl uploads?" auth="nikic" voteType="single" closed="true"> |
| * Yes |
| * No |
| </doodle> |
| |
| ==== preg_replace() eval modifier ==== |
| |
| Due to security considerations the [[rfc/remove_preg_replace_eval_modifier]] RFC has deprecated the ''/e'' (eval) modifier used by ''preg_replace()'' in PHP 5.5. Instead ''preg_replace_callback'' should be used. |
| |
| Vote: Requires simple majority. |
| |
| <doodle title="Remove preg_replace() eval modifier?" auth="nikic" voteType="single" closed="true"> |
| * Yes |
| * No |
| </doodle> |
| |
| ==== PDO::PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT driver option ==== |
| |
| In PHP 5.6 the pgsql specific driver option ''PDO::PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT'' was deprecated in favor of the more general ''PDO::ATTR_EMULATE_PREPARES'' option. |
| |
| Vote: Requires simple majority. |
| |
| <doodle title="Remove PDO::PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT driver option?" auth="nikic" voteType="single" closed="true"> |
| * Yes |
| * No |
| </doodle> |
| |
| ==== CN_match and SNI_server_name stream context options ==== |
| |
| Since PHP 5.6 it is no longer necessary to explicitly specify the host name using the ''CN_match'' and ''SNI_server_name'' stream context options, it will be determined automatically instead. It is possible to manually specify a host name using the ''peer_name'' context option, which covers both CN and SNI. The old, separate options have been deprecated. |
| |
| Vote: Requires simple majority. |
| |
Vote: Requires simple majority | <doodle title="Remove CN_match and SNI_server_name stream context options?" auth="nikic" voteType="single" closed="true"> |
| * Yes |
| * No |
| </doodle> |