rfc:remove_deprecated_functionality_in_php7

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 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) [TODO]

The following ini options are deprecated:

  • xsl.security_prefs (since PHP 5.4; use XsltProcessor::setSecurityPrefs instead)
  • 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:

  • # style comments in ini files (since PHP 5.3; use ; style comments instead)
  • String category names in setlocale() (since PHP 5.3; use LC_* constants instead)
  • 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)
  • preg_replace() eval modifier (since PHP 5.5; use preg_replace_callback instead)
  • PDO::PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT driver option (since PHP 5.6; use PDO::ATTR_EMULATE_PREPARES instead) [TODO]
  • CN_match and SNI_server_name stream context option (since PHP 5.6; use peer_name instead) [TODO]

Patches and Tests

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 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.

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::setSecurityPrefs instead)
  • 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:

  • # style comments in ini files (since PHP 5.3; use ; style comments instead)
  • String category names in setlocale() (since PHP 5.3; use LC_* constants instead)
  • 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)
  • preg_replace() eval modifier (since PHP 5.5; use preg_replace_callback instead)
  • PDO::PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT driver option (since PHP 5.6; use PDO::ATTR_EMULATE_PREPARES instead) [TODO]
  • CN_match and SNI_server_name stream context option (since PHP 5.6; use peer_name instead) [TODO]

Vote: Requires simple majority

1)
reference-breaking notwithstanding
rfc/remove_deprecated_functionality_in_php7.1419090878.txt.gz · Last modified: 2017/09/22 13:28 (external edit)