Deprecations for PHP 7.4 by nikic · Pull Request #4390 · php/php-src

@nikic nikic changed the title [WIP] Deprecations for PHP 7.4 Deprecations for PHP 7.4

Jul 12, 2019

@nikic

@nikic

And remove the Reflector::export() interface method.

@nikic

@nikic

@nikic

@nikic

@nikic

@nikic

@nikic

@nikic

@nikic

@nikic

@nikic

@nikic

jrfnl added a commit to PHPCompatibility/PHPCompatibility that referenced this pull request

Jul 22, 2019

jrfnl added a commit to PHPCompatibility/PHPCompatibility that referenced this pull request

Jul 22, 2019
…r constant

> Magic quotes were deprecated all the way back in PHP 5.3 and later removed in PHP 5.4. The filter extension implements a sanitization filter that mimics this behavior of `magic_quotes` by calling `addslashes()` on the input in question.
>
> In PHP 7.3 `add_slashes (FILTER_SANITIZE_ADD_SLASHES)` was added as a new alias for this filter, to allow us to move away from the `magic_quotes` terminology.
>
> Proposed action: Emit a deprecation notice each time the `FILTER_SANITIZE_MAGIC_QUOTES` filter is used and advise users to use the `add_slashes (FILTER_SANITIZE_ADD_SLASHES)` filter instead.

This constant is to be removed in PHP 8.0.

Refs:
* https://wiki.php.net/rfc/deprecations_php_7_4#filter_sanitize_magic_quotes
* php/php-src#4390
* php/php-src@cd2f2cd

jrfnl added a commit to PHPCompatibility/PHPCompatibility that referenced this pull request

Jul 22, 2019

jrfnl added a commit to PHPCompatibility/PHPCompatibility that referenced this pull request

Jul 22, 2019
…ions

>  PHP's infamous `magic_quotes` configuration was removed in PHP 5.4 and the function implementations of checking whether or not these settings have been enabled have returned `false` since then. With PHP 7.0 not having `magic_quotes` at all, it is time to deprecate these functions and remove them entirely.
>
> Proposal: Mark `get_magic_quotes_gpc()` and `get_magic_quotes_runtime()` as deprecated. This should only impact legacy code bases prior to PHP 5.4, running non-supported versions of PHP.

These functions are expected to be removed in PHP 8.0.

Refs:
* https://wiki.php.net/rfc/deprecations_php_7_4#magic_quotes_legacy
* php/php-src#4390
* php/php-src@b2ea507

jrfnl added a commit to PHPCompatibility/PHPCompatibility that referenced this pull request

Jul 22, 2019
> The `hebrevc()` function is equivalent to calling `nl2br()` on the result of `hebrev()`, which is a function to convert Hebrew text from logical to visual ordering. While `nl2br(hebrev($str))` is already preferable over `hebrevc($str)` for readability reasons, use of visual ordering is only relevant in contexts that do not have proper Unicode bidi support, such as certain terminals. As detailed in W3C Visual vs. logical ordering of text, visual ordering should never be used for HTML. The `hebrevc()` function is an explicit violation of this principle.
>
> Proposal: Mark `hebrevc()` as deprecated.

This function is expected to be removed in PHP 8.0.

Refs:
* https://wiki.php.net/rfc/deprecations_php_7_4#hebrevc_function
* php/php-src#4390
* php/php-src@4e4d8a4

**Note**: While `nl2br(hebrev($str))` is equivalent, as visual ordering shouldn't be used in HTML and `nl2br()` is only useful in HTML contexts, this equivalent has _not_ been marked as a valid alternative.

jrfnl added a commit to PHPCompatibility/PHPCompatibility that referenced this pull request

Jul 22, 2019
> The `convert_cyr_string()` function allows conversion between Cyrillic character sets. The character sets are specified using obscure single character names, such as `convert_cyr_string($str, 'k', 'i')`. This is a legacy function from a time where PHP did not provide general functions for conversion between character sets. Nowadays one of `mb_convert_encoding()`, `iconv()` or `UConverter` may be used for this purpose.
>
> Proposal: Mark `convert_cyr_string()` as deprecated.

This function is expected to be removed in PHP 8.0.

Refs:
* https://wiki.php.net/rfc/deprecations_php_7_4#convert_cyr_string
* php/php-src#4390
* php/php-src@b3668aa

jrfnl added a commit to PHPCompatibility/PHPCompatibility that referenced this pull request

Jul 22, 2019
> The `money_format()` function formats currency values using locale-specific settings. It is based on the `strfmon()` C function, which is not supported on all platforms. Most notably it is not available on Windows. Nowadays the `NumberFormatter::formatCurrency()` method provided by `intl` should be used instead, which is both platform-independent and does not rely on the system locale. Additionally, `intl` also provides the ability to parse currency values using `NumberFormatter::parseCurrency()`.
>
> Furthermore, the `strfmon()` implementation seems to have an internal buffer overrun on macos, which indicates that this functionality is not well tested.

This function is expected to be removed in PHP 8.0.

Refs:
* https://wiki.php.net/rfc/deprecations_php_7_4#money_format
* php/php-src#4390
* php/php-src@b1cdf06

jrfnl added a commit to PHPCompatibility/PHPCompatibility that referenced this pull request

Jul 22, 2019
> The `ezmlm_hash()` function creates hashes of email addresses which the EZMLM/QMail mailing list system understands. This function is of very limited usefulness for the average PHP developer as the EZMLM/QMail system is barely maintained and its last release was in 2007. The function was most likely originally added for use in the php.net mailing list infrastructure. It can be trivially reimplemented in userland code if needed.
>
> Proposal: Mark `ezmlm_hash()` as deprecated.

This function is expected to be removed in PHP 8.0.

Refs:
* https://wiki.php.net/rfc/deprecations_php_7_4#ezmlm_hash
* php/php-src#4390
* php/php-src@e9e2fa4

jrfnl added a commit to PHPCompatibility/PHPCompatibility that referenced this pull request

Jul 22, 2019
> This function is essentially an “alias” of doing `ini_restore('include_path')`. Unlike other functions like `restore_error_handler()` or `restore_exception_handler()`, this function does not operate on a stack and always resets to the original/initial value. While you can use `set_error_handler()` and `restore_error_handler()` as a pair, doing the same with `set_include_path() and `restore_include_path()` is not safe. As such, this function does not offer any benefit over `ini_restore('include_path')` and just causes wrong expectations.
>
> Proposal: Mark `restore_include_path()` as deprecated.

This function is expected to be removed in PHP 8.0.

Refs:
* https://wiki.php.net/rfc/deprecations_php_7_4#restore_include_path_function
* php/php-src#4390
* php/php-src@964de03

This was referenced

Jul 22, 2019

jrfnl added a commit to PHPCompatibility/PHPCompatibility that referenced this pull request

Jul 22, 2019

jrfnl added a commit to PHPCompatibility/PHPCompatibility that referenced this pull request

Jul 22, 2019
…ions

>  PHP's infamous `magic_quotes` configuration was removed in PHP 5.4 and the function implementations of checking whether or not these settings have been enabled have returned `false` since then. With PHP 7.0 not having `magic_quotes` at all, it is time to deprecate these functions and remove them entirely.
>
> Proposal: Mark `get_magic_quotes_gpc()` and `get_magic_quotes_runtime()` as deprecated. This should only impact legacy code bases prior to PHP 5.4, running non-supported versions of PHP.

These functions are expected to be removed in PHP 8.0.

Refs:
* https://wiki.php.net/rfc/deprecations_php_7_4#magic_quotes_legacy
* php/php-src#4390
* php/php-src@b2ea507

jrfnl added a commit to PHPCompatibility/PHPCompatibility that referenced this pull request

Jul 22, 2019
> The `hebrevc()` function is equivalent to calling `nl2br()` on the result of `hebrev()`, which is a function to convert Hebrew text from logical to visual ordering. While `nl2br(hebrev($str))` is already preferable over `hebrevc($str)` for readability reasons, use of visual ordering is only relevant in contexts that do not have proper Unicode bidi support, such as certain terminals. As detailed in W3C Visual vs. logical ordering of text, visual ordering should never be used for HTML. The `hebrevc()` function is an explicit violation of this principle.
>
> Proposal: Mark `hebrevc()` as deprecated.

This function is expected to be removed in PHP 8.0.

Refs:
* https://wiki.php.net/rfc/deprecations_php_7_4#hebrevc_function
* php/php-src#4390
* php/php-src@4e4d8a4

**Note**: While `nl2br(hebrev($str))` is equivalent, as visual ordering shouldn't be used in HTML and `nl2br()` is only useful in HTML contexts, this equivalent has _not_ been marked as a valid alternative.

jrfnl added a commit to PHPCompatibility/PHPCompatibility that referenced this pull request

Jul 22, 2019
> The `convert_cyr_string()` function allows conversion between Cyrillic character sets. The character sets are specified using obscure single character names, such as `convert_cyr_string($str, 'k', 'i')`. This is a legacy function from a time where PHP did not provide general functions for conversion between character sets. Nowadays one of `mb_convert_encoding()`, `iconv()` or `UConverter` may be used for this purpose.
>
> Proposal: Mark `convert_cyr_string()` as deprecated.

This function is expected to be removed in PHP 8.0.

Refs:
* https://wiki.php.net/rfc/deprecations_php_7_4#convert_cyr_string
* php/php-src#4390
* php/php-src@b3668aa

jrfnl added a commit to PHPCompatibility/PHPCompatibility that referenced this pull request

Jul 22, 2019
> The `money_format()` function formats currency values using locale-specific settings. It is based on the `strfmon()` C function, which is not supported on all platforms. Most notably it is not available on Windows. Nowadays the `NumberFormatter::formatCurrency()` method provided by `intl` should be used instead, which is both platform-independent and does not rely on the system locale. Additionally, `intl` also provides the ability to parse currency values using `NumberFormatter::parseCurrency()`.
>
> Furthermore, the `strfmon()` implementation seems to have an internal buffer overrun on macos, which indicates that this functionality is not well tested.

This function is expected to be removed in PHP 8.0.

Refs:
* https://wiki.php.net/rfc/deprecations_php_7_4#money_format
* php/php-src#4390
* php/php-src@b1cdf06

jrfnl added a commit to PHPCompatibility/PHPCompatibility that referenced this pull request

Jul 22, 2019
> The `ezmlm_hash()` function creates hashes of email addresses which the EZMLM/QMail mailing list system understands. This function is of very limited usefulness for the average PHP developer as the EZMLM/QMail system is barely maintained and its last release was in 2007. The function was most likely originally added for use in the php.net mailing list infrastructure. It can be trivially reimplemented in userland code if needed.
>
> Proposal: Mark `ezmlm_hash()` as deprecated.

This function is expected to be removed in PHP 8.0.

Refs:
* https://wiki.php.net/rfc/deprecations_php_7_4#ezmlm_hash
* php/php-src#4390
* php/php-src@e9e2fa4

jrfnl added a commit to PHPCompatibility/PHPCompatibility that referenced this pull request

Jul 22, 2019
> This function is essentially an “alias” of doing `ini_restore('include_path')`. Unlike other functions like `restore_error_handler()` or `restore_exception_handler()`, this function does not operate on a stack and always resets to the original/initial value. While you can use `set_error_handler()` and `restore_error_handler()` as a pair, doing the same with `set_include_path() and `restore_include_path()` is not safe. As such, this function does not offer any benefit over `ini_restore('include_path')` and just causes wrong expectations.
>
> Proposal: Mark `restore_include_path()` as deprecated.

This function is expected to be removed in PHP 8.0.

Refs:
* https://wiki.php.net/rfc/deprecations_php_7_4#restore_include_path_function
* php/php-src#4390
* php/php-src@964de03

@jrfnl jrfnl mentioned this pull request

Jul 22, 2019

jrfnl added a commit to PHPCompatibility/PHPCompatibility that referenced this pull request

Aug 21, 2019
> This function is essentially an “alias” of doing `ini_restore('include_path')`. Unlike other functions like `restore_error_handler()` or `restore_exception_handler()`, this function does not operate on a stack and always resets to the original/initial value. While you can use `set_error_handler()` and `restore_error_handler()` as a pair, doing the same with `set_include_path() and `restore_include_path()` is not safe. As such, this function does not offer any benefit over `ini_restore('include_path')` and just causes wrong expectations.
>
> Proposal: Mark `restore_include_path()` as deprecated.

This function is expected to be removed in PHP 8.0.

Refs:
* https://wiki.php.net/rfc/deprecations_php_7_4#restore_include_path_function
* php/php-src#4390
* php/php-src@964de03

jrfnl added a commit to PHPCompatibility/PHPCompatibility that referenced this pull request

Aug 21, 2019

jrfnl added a commit to PHPCompatibility/PHPCompatibility that referenced this pull request

Aug 21, 2019
…ions

>  PHP's infamous `magic_quotes` configuration was removed in PHP 5.4 and the function implementations of checking whether or not these settings have been enabled have returned `false` since then. With PHP 7.0 not having `magic_quotes` at all, it is time to deprecate these functions and remove them entirely.
>
> Proposal: Mark `get_magic_quotes_gpc()` and `get_magic_quotes_runtime()` as deprecated. This should only impact legacy code bases prior to PHP 5.4, running non-supported versions of PHP.

These functions are expected to be removed in PHP 8.0.

Refs:
* https://wiki.php.net/rfc/deprecations_php_7_4#magic_quotes_legacy
* php/php-src#4390
* php/php-src@b2ea507

jrfnl added a commit to PHPCompatibility/PHPCompatibility that referenced this pull request

Aug 21, 2019
> The `hebrevc()` function is equivalent to calling `nl2br()` on the result of `hebrev()`, which is a function to convert Hebrew text from logical to visual ordering. While `nl2br(hebrev($str))` is already preferable over `hebrevc($str)` for readability reasons, use of visual ordering is only relevant in contexts that do not have proper Unicode bidi support, such as certain terminals. As detailed in W3C Visual vs. logical ordering of text, visual ordering should never be used for HTML. The `hebrevc()` function is an explicit violation of this principle.
>
> Proposal: Mark `hebrevc()` as deprecated.

This function is expected to be removed in PHP 8.0.

Refs:
* https://wiki.php.net/rfc/deprecations_php_7_4#hebrevc_function
* php/php-src#4390
* php/php-src@4e4d8a4

**Note**: While `nl2br(hebrev($str))` is equivalent, as visual ordering shouldn't be used in HTML and `nl2br()` is only useful in HTML contexts, this equivalent has _not_ been marked as a valid alternative.

jrfnl added a commit to PHPCompatibility/PHPCompatibility that referenced this pull request

Aug 21, 2019
> The `convert_cyr_string()` function allows conversion between Cyrillic character sets. The character sets are specified using obscure single character names, such as `convert_cyr_string($str, 'k', 'i')`. This is a legacy function from a time where PHP did not provide general functions for conversion between character sets. Nowadays one of `mb_convert_encoding()`, `iconv()` or `UConverter` may be used for this purpose.
>
> Proposal: Mark `convert_cyr_string()` as deprecated.

This function is expected to be removed in PHP 8.0.

Refs:
* https://wiki.php.net/rfc/deprecations_php_7_4#convert_cyr_string
* php/php-src#4390
* php/php-src@b3668aa

jrfnl added a commit to PHPCompatibility/PHPCompatibility that referenced this pull request

Aug 21, 2019
> The `money_format()` function formats currency values using locale-specific settings. It is based on the `strfmon()` C function, which is not supported on all platforms. Most notably it is not available on Windows. Nowadays the `NumberFormatter::formatCurrency()` method provided by `intl` should be used instead, which is both platform-independent and does not rely on the system locale. Additionally, `intl` also provides the ability to parse currency values using `NumberFormatter::parseCurrency()`.
>
> Furthermore, the `strfmon()` implementation seems to have an internal buffer overrun on macos, which indicates that this functionality is not well tested.

This function is expected to be removed in PHP 8.0.

Refs:
* https://wiki.php.net/rfc/deprecations_php_7_4#money_format
* php/php-src#4390
* php/php-src@b1cdf06

jrfnl added a commit to PHPCompatibility/PHPCompatibility that referenced this pull request

Aug 21, 2019
> The `ezmlm_hash()` function creates hashes of email addresses which the EZMLM/QMail mailing list system understands. This function is of very limited usefulness for the average PHP developer as the EZMLM/QMail system is barely maintained and its last release was in 2007. The function was most likely originally added for use in the php.net mailing list infrastructure. It can be trivially reimplemented in userland code if needed.
>
> Proposal: Mark `ezmlm_hash()` as deprecated.

This function is expected to be removed in PHP 8.0.

Refs:
* https://wiki.php.net/rfc/deprecations_php_7_4#ezmlm_hash
* php/php-src#4390
* php/php-src@e9e2fa4

jrfnl added a commit to PHPCompatibility/PHPCompatibility that referenced this pull request

Aug 21, 2019
> This function is essentially an “alias” of doing `ini_restore('include_path')`. Unlike other functions like `restore_error_handler()` or `restore_exception_handler()`, this function does not operate on a stack and always resets to the original/initial value. While you can use `set_error_handler()` and `restore_error_handler()` as a pair, doing the same with `set_include_path() and `restore_include_path()` is not safe. As such, this function does not offer any benefit over `ini_restore('include_path')` and just causes wrong expectations.
>
> Proposal: Mark `restore_include_path()` as deprecated.

This function is expected to be removed in PHP 8.0.

Refs:
* https://wiki.php.net/rfc/deprecations_php_7_4#restore_include_path_function
* php/php-src#4390
* php/php-src@964de03