rfc:remove_deprecated_functionality_in_php7

PHP RFC: Remove deprecated functionality in PHP 7

Introduction

This RFC proposes to remove functionality which has been deprecated during the 5.x cycle.

The following extensions are deprecated:

The following language features are deprecated:

  • Assignment of new by reference (since PHP 5.3; use normal assignment instead) REMOVED
  • Scoped calls of non-static methods from incompatible $this context (since PHP 5.6) REMOVED

The following functions are deprecated:

  • dl on fpm-fcgi (since PHP 5.3) REMOVED
  • set_magic_quotes_runtime and magic_quotes_runtime (since PHP 5.4) REMOVED
  • set_socket_blocking (since PHP 5.4; use stream_set_blocking instead) REMOVED
  • mcrypt_generic_end (since PHP 5.4; use mcrypt_generic_deinit instead) 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) REMOVED
  • datefmt_set_timezone_id and IntlDateFormatter::setTimeZoneID (since PHP 5.5; use datefmt_set_timezone or IntlDateFormatter::setTimeZone instead) REMOVED

The following ini options are deprecated:

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

The following miscellaneous functionality is deprecated:

  • The $is_dst parameter of the mktime() and gmmktime() functions (since PHP 5.1) REMOVED
  • # style comments in ini files (since PHP 5.3; use ; style comments instead) REMOVED
  • String category names in setlocale() (since PHP 5.3; use LC_* constants instead) REMOVED
  • Unsafe curl file uploads (since PHP 5.5; use CurlFile instead) REMOVED
  • preg_replace() eval modifier (since PHP 5.5; use preg_replace_callback instead) REMOVED
  • PDO::PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT driver option (since PHP 5.6; use PDO::ATTR_EMULATE_PREPARES instead) REMOVED
  • CN_match and SNI_server_name stream context option (since PHP 5.6; use peer_name instead) REMOVED

Patches and Tests

Note: Patches are very outdated. I'll update them after the 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

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.

Unbundle the ext/ereg extension?
Real name Yes No
aharvey (aharvey)  
ajf (ajf)  
brandon (brandon)  
bwoebi (bwoebi)  
dm (dm)  
dmitry (dmitry)  
dsp (dsp)  
fa (fa)  
francois (francois)  
galvao (galvao)  
guilhermeblanco (guilhermeblanco)  
gwynne (gwynne)  
irker (irker)  
jedibc (jedibc)  
jpauli (jpauli)  
kalle (kalle)  
kinncj (kinncj)  
krakjoe (krakjoe)  
kriscraig (kriscraig)  
laruence (laruence)  
leigh (leigh)  
levim (levim)  
lstrojny (lstrojny)  
mbeccati (mbeccati)  
mike (mike)  
nikic (nikic)  
peehaa (peehaa)  
philstu (philstu)  
pollita (pollita)  
rasmus (rasmus)  
rdohms (rdohms)  
remi (remi)  
salathe (salathe)  
sebastian (sebastian)  
stas (stas)  
stelianm (stelianm)  
thekid (thekid)  
till (till)  
tyrael (tyrael)  
yunosh (yunosh)  
Final result: 37 3
This poll has been closed.

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.

Unbundle the ext/mysql extension?
Real name Yes No
ab (ab)  
aharvey (aharvey)  
ajf (ajf)  
bwoebi (bwoebi)  
dm (dm)  
dmitry (dmitry)  
dsp (dsp)  
fredemmott (fredemmott)  
galvao (galvao)  
guilhermeblanco (guilhermeblanco)  
gwynne (gwynne)  
irker (irker)  
jedibc (jedibc)  
jpauli (jpauli)  
kalle (kalle)  
kinncj (kinncj)  
krakjoe (krakjoe)  
kriscraig (kriscraig)  
laruence (laruence)  
leigh (leigh)  
levim (levim)  
lstrojny (lstrojny)  
mbeccati (mbeccati)  
mike (mike)  
nikic (nikic)  
peehaa (peehaa)  
philstu (philstu)  
pollita (pollita)  
rasmus (rasmus)  
rdohms (rdohms)  
remi (remi)  
salathe (salathe)  
sebastian (sebastian)  
stas (stas)  
stelianm (stelianm)  
thekid (thekid)  
till (till)  
tyrael (tyrael)  
yunosh (yunosh)  
zeev (zeev)  
Final result: 28 12
This poll has been closed.

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.

Remove assignment of new by reference?
Real name Yes No
aharvey (aharvey)  
ajf (ajf)  
bwoebi (bwoebi)  
dm (dm)  
fa (fa)  
francois (francois)  
galvao (galvao)  
guilhermeblanco (guilhermeblanco)  
gwynne (gwynne)  
irker (irker)  
jedibc (jedibc)  
jpauli (jpauli)  
kalle (kalle)  
krakjoe (krakjoe)  
kriscraig (kriscraig)  
laruence (laruence)  
leigh (leigh)  
levim (levim)  
lstrojny (lstrojny)  
mbeccati (mbeccati)  
mike (mike)  
nikic (nikic)  
peehaa (peehaa)  
philstu (philstu)  
pollita (pollita)  
rasmus (rasmus)  
rdohms (rdohms)  
salathe (salathe)  
sebastian (sebastian)  
seld (seld)  
stas (stas)  
stelianm (stelianm)  
thekid (thekid)  
till (till)  
tyrael (tyrael)  
yunosh (yunosh)  
zeev (zeev)  
Final result: 31 6
This poll has been closed.

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.

Remove support for calls from incompatible context?
Real name Yes No
aharvey (aharvey)  
ajf (ajf)  
dmitry (dmitry)  
dsp (dsp)  
fredemmott (fredemmott)  
galvao (galvao)  
guilhermeblanco (guilhermeblanco)  
gwynne (gwynne)  
irker (irker)  
jedibc (jedibc)  
jpauli (jpauli)  
kalle (kalle)  
krakjoe (krakjoe)  
kriscraig (kriscraig)  
laruence (laruence)  
leigh (leigh)  
levim (levim)  
lstrojny (lstrojny)  
mbeccati (mbeccati)  
mike (mike)  
nikic (nikic)  
peehaa (peehaa)  
philstu (philstu)  
pollita (pollita)  
rasmus (rasmus)  
rdohms (rdohms)  
salathe (salathe)  
sebastian (sebastian)  
stas (stas)  
stelianm (stelianm)  
thekid (thekid)  
till (till)  
tyrael (tyrael)  
zeev (zeev)  
Final result: 34 0
This poll has been closed.

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.

Remove dl() in fpm-fcgi SAPI?
Real name Yes No
aharvey (aharvey)  
ajf (ajf)  
bwoebi (bwoebi)  
dmitry (dmitry)  
dsp (dsp)  
fa (fa)  
galvao (galvao)  
guilhermeblanco (guilhermeblanco)  
gwynne (gwynne)  
irker (irker)  
jedibc (jedibc)  
jpauli (jpauli)  
kalle (kalle)  
krakjoe (krakjoe)  
kriscraig (kriscraig)  
laruence (laruence)  
leigh (leigh)  
lstrojny (lstrojny)  
mbeccati (mbeccati)  
mike (mike)  
nikic (nikic)  
peehaa (peehaa)  
pollita (pollita)  
rasmus (rasmus)  
rdohms (rdohms)  
salathe (salathe)  
sebastian (sebastian)  
stas (stas)  
stelianm (stelianm)  
till (till)  
tyrael (tyrael)  
yunosh (yunosh)  
Final result: 32 0
This poll has been closed.

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.

Remove (set_)magic_quotes_runtime() functions?
Real name Yes No
aharvey (aharvey)  
ajf (ajf)  
bwoebi (bwoebi)  
dsp (dsp)  
fa (fa)  
francois (francois)  
fredemmott (fredemmott)  
galvao (galvao)  
guilhermeblanco (guilhermeblanco)  
gwynne (gwynne)  
irker (irker)  
jedibc (jedibc)  
jpauli (jpauli)  
kalle (kalle)  
krakjoe (krakjoe)  
kriscraig (kriscraig)  
laruence (laruence)  
leigh (leigh)  
levim (levim)  
lstrojny (lstrojny)  
mbeccati (mbeccati)  
mike (mike)  
nikic (nikic)  
peehaa (peehaa)  
philstu (philstu)  
pollita (pollita)  
rasmus (rasmus)  
rdohms (rdohms)  
salathe (salathe)  
sebastian (sebastian)  
stas (stas)  
stelianm (stelianm)  
thekid (thekid)  
till (till)  
tyrael (tyrael)  
yunosh (yunosh)  
Final result: 36 0
This poll has been closed.

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.

Remove listed deprecated functions?
Real name Yes No
aharvey (aharvey)  
ajf (ajf)  
bwoebi (bwoebi)  
dsp (dsp)  
fa (fa)  
galvao (galvao)  
guilhermeblanco (guilhermeblanco)  
gwynne (gwynne)  
irker (irker)  
jedibc (jedibc)  
jpauli (jpauli)  
kalle (kalle)  
krakjoe (krakjoe)  
kriscraig (kriscraig)  
laruence (laruence)  
leigh (leigh)  
lstrojny (lstrojny)  
mbeccati (mbeccati)  
mike (mike)  
nikic (nikic)  
peehaa (peehaa)  
philstu (philstu)  
pollita (pollita)  
rasmus (rasmus)  
rdohms (rdohms)  
salathe (salathe)  
sobak (sobak)  
stelianm (stelianm)  
till (till)  
tyrael (tyrael)  
yunosh (yunosh)  
Final result: 31 0
This poll has been closed.

xsl.security_prefs ini directive

As a fix for CVE 2012-0057 (Bug #54446), which concerns reading and writing files using XSLT, the XsltProcessor::setSecurityPrefs() method and xsl.security_prefs ini directive have been added. The latter has been deprecated in PHP 5.4 to discourage global disabling of security features. Instead the setSecurityPrefs() method should be used on individual XsltProcessor instances where reading/writing files is necessary.

Vote: Requires simple majority.

Remove xsl.security_prefs ini directive?
Real name Yes No
aharvey (aharvey)  
ajf (ajf)  
bwoebi (bwoebi)  
fa (fa)  
galvao (galvao)  
guilhermeblanco (guilhermeblanco)  
gwynne (gwynne)  
jedibc (jedibc)  
jpauli (jpauli)  
kalle (kalle)  
krakjoe (krakjoe)  
kriscraig (kriscraig)  
leigh (leigh)  
levim (levim)  
lstrojny (lstrojny)  
mbeccati (mbeccati)  
mike (mike)  
nikic (nikic)  
peehaa (peehaa)  
philstu (philstu)  
pollita (pollita)  
rasmus (rasmus)  
salathe (salathe)  
stas (stas)  
stelianm (stelianm)  
till (till)  
tyrael (tyrael)  
yunosh (yunosh)  
Final result: 28 0
This poll has been closed.

iconv and mbstring encoding ini directives

The iconv.input_encoding, iconv.output_encoding, iconv.internal_encoding, mbstring.http_input, mbstring.http_output and mbstring.internal_encoding ini directives have been deprecated in PHP 5.6 by the default_encoding RFC. Instead the use of the more general php.input_encoding, php.internal_encoding and php.output_encoding ini directives is suggested.

Vote: Requires simple majority.

Remove extension specific encoding ini directives?
Real name Yes No
aharvey (aharvey)  
ajf (ajf)  
bwoebi (bwoebi)  
dmitry (dmitry)  
galvao (galvao)  
guilhermeblanco (guilhermeblanco)  
gwynne (gwynne)  
jedibc (jedibc)  
jpauli (jpauli)  
kalle (kalle)  
krakjoe (krakjoe)  
kriscraig (kriscraig)  
leigh (leigh)  
lstrojny (lstrojny)  
mbeccati (mbeccati)  
mike (mike)  
peehaa (peehaa)  
philstu (philstu)  
pollita (pollita)  
rasmus (rasmus)  
salathe (salathe)  
stas (stas)  
stelianm (stelianm)  
till (till)  
tyrael (tyrael)  
yunosh (yunosh)  
Final result: 26 0
This poll has been closed.

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

Remove $is_dst parameter of the mktime() and gmmktime() functions?
Real name Yes No
aharvey (aharvey)  
ajf (ajf)  
galvao (galvao)  
guilhermeblanco (guilhermeblanco)  
gwynne (gwynne)  
irker (irker)  
jedibc (jedibc)  
jpauli (jpauli)  
kalle (kalle)  
krakjoe (krakjoe)  
kriscraig (kriscraig)  
leigh (leigh)  
lstrojny (lstrojny)  
mbeccati (mbeccati)  
mike (mike)  
nikic (nikic)  
peehaa (peehaa)  
philstu (philstu)  
pollita (pollita)  
rasmus (rasmus)  
salathe (salathe)  
sebastian (sebastian)  
stas (stas)  
stelianm (stelianm)  
thekid (thekid)  
till (till)  
tyrael (tyrael)  
yunosh (yunosh)  
Final result: 28 0
This poll has been closed.

#-style comments in ini files

The standard ini file format uses ; to denote comments. However PHP accidentially (?) also supported comments starting with # in some circumstances. When this was discovered in PHP 5.3, they were deprecated.

Vote: Requires simple majority.

Remove support for #-style comments in ini files?
Real name Yes No
aharvey (aharvey)  
ajf (ajf)  
dmitry (dmitry)  
fa (fa)  
galvao (galvao)  
guilhermeblanco (guilhermeblanco)  
gwynne (gwynne)  
irker (irker)  
jedibc (jedibc)  
jpauli (jpauli)  
kalle (kalle)  
krakjoe (krakjoe)  
kriscraig (kriscraig)  
leigh (leigh)  
levim (levim)  
lstrojny (lstrojny)  
mbeccati (mbeccati)  
mike (mike)  
nikic (nikic)  
peehaa (peehaa)  
philstu (philstu)  
pollita (pollita)  
rasmus (rasmus)  
rdohms (rdohms)  
salathe (salathe)  
sebastian (sebastian)  
stelianm (stelianm)  
thekid (thekid)  
till (till)  
tyrael (tyrael)  
yunosh (yunosh)  
Final result: 27 4
This poll has been closed.

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:

// Instead of
setlocale('LC_ALL', 'de_DE');
// Write
setlocale(LC_ALL, 'de_DE');

Vote: Requires simple majority.

Disallow string category names in setlocale()?
Real name Yes No
aharvey (aharvey)  
ajf (ajf)  
galvao (galvao)  
guilhermeblanco (guilhermeblanco)  
gwynne (gwynne)  
irker (irker)  
jedibc (jedibc)  
jpauli (jpauli)  
kalle (kalle)  
krakjoe (krakjoe)  
kriscraig (kriscraig)  
leigh (leigh)  
lstrojny (lstrojny)  
mbeccati (mbeccati)  
mike (mike)  
nikic (nikic)  
peehaa (peehaa)  
philstu (philstu)  
pollita (pollita)  
rasmus (rasmus)  
salathe (salathe)  
sebastian (sebastian)  
sobak (sobak)  
stas (stas)  
stelianm (stelianm)  
till (till)  
tyrael (tyrael)  
yunosh (yunosh)  
Final result: 27 1
This poll has been closed.

Unsafe curl file uploads

As part of the 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.

For compatibility purposes the option will not be removed altogether, only the ability to set it to false is removed.

Vote: Requires simple majority.

Disallow enabling unsafe curl uploads?
Real name Yes No
aharvey (aharvey)  
ajf (ajf)  
fredemmott (fredemmott)  
galvao (galvao)  
guilhermeblanco (guilhermeblanco)  
gwynne (gwynne)  
jpauli (jpauli)  
kalle (kalle)  
krakjoe (krakjoe)  
kriscraig (kriscraig)  
laruence (laruence)  
leigh (leigh)  
lstrojny (lstrojny)  
mbeccati (mbeccati)  
mike (mike)  
nikic (nikic)  
peehaa (peehaa)  
philstu (philstu)  
pollita (pollita)  
rasmus (rasmus)  
salathe (salathe)  
sebastian (sebastian)  
stas (stas)  
till (till)  
tyrael (tyrael)  
Final result: 19 6
This poll has been closed.

preg_replace() eval modifier

Due to security considerations the 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.

Remove preg_replace() eval modifier?
Real name Yes No
aharvey (aharvey)  
ajf (ajf)  
bwoebi (bwoebi)  
dmitry (dmitry)  
dsp (dsp)  
fa (fa)  
galvao (galvao)  
guilhermeblanco (guilhermeblanco)  
gwynne (gwynne)  
irker (irker)  
jedibc (jedibc)  
jpauli (jpauli)  
kalle (kalle)  
krakjoe (krakjoe)  
kriscraig (kriscraig)  
leigh (leigh)  
levim (levim)  
lstrojny (lstrojny)  
mbeccati (mbeccati)  
mike (mike)  
nikic (nikic)  
peehaa (peehaa)  
philstu (philstu)  
pollita (pollita)  
rasmus (rasmus)  
salathe (salathe)  
sebastian (sebastian)  
sobak (sobak)  
stas (stas)  
stelianm (stelianm)  
thekid (thekid)  
till (till)  
tyrael (tyrael)  
yunosh (yunosh)  
Final result: 33 1
This poll has been closed.

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.

Remove PDO::PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT driver option?
Real name Yes No
aharvey (aharvey)  
ajf (ajf)  
galvao (galvao)  
guilhermeblanco (guilhermeblanco)  
gwynne (gwynne)  
jedibc (jedibc)  
jpauli (jpauli)  
kalle (kalle)  
krakjoe (krakjoe)  
kriscraig (kriscraig)  
laruence (laruence)  
leigh (leigh)  
lstrojny (lstrojny)  
mbeccati (mbeccati)  
mike (mike)  
nikic (nikic)  
peehaa (peehaa)  
philstu (philstu)  
pollita (pollita)  
rasmus (rasmus)  
salathe (salathe)  
sebastian (sebastian)  
stas (stas)  
tyrael (tyrael)  
yunosh (yunosh)  
Final result: 20 5
This poll has been closed.

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.

Remove CN_match and SNI_server_name stream context options?
Real name Yes No
aharvey (aharvey)  
ajf (ajf)  
bwoebi (bwoebi)  
galvao (galvao)  
guilhermeblanco (guilhermeblanco)  
gwynne (gwynne)  
jedibc (jedibc)  
jpauli (jpauli)  
kalle (kalle)  
krakjoe (krakjoe)  
kriscraig (kriscraig)  
leigh (leigh)  
lstrojny (lstrojny)  
mbeccati (mbeccati)  
mike (mike)  
nikic (nikic)  
peehaa (peehaa)  
philstu (philstu)  
pollita (pollita)  
rasmus (rasmus)  
salathe (salathe)  
sebastian (sebastian)  
stas (stas)  
till (till)  
tyrael (tyrael)  
Final result: 20 5
This poll has been closed.
1)
reference-breaking notwithstanding
rfc/remove_deprecated_functionality_in_php7.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1