Skip to content

Deprecations for PHP 7.4 #4390

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 15 commits into from
Closed

Deprecations for PHP 7.4 #4390

wants to merge 15 commits into from

Conversation

nikic
Copy link
Member

@nikic nikic commented Jul 11, 2019

Implementation for https://wiki.php.net/rfc/deprecations_php_7_4.

  • (real)
  • is_real()
  • get_magic_quotes_gpc() and get_magic_quotes_runtime()
  • array_key_exists() with objects
  • FILTER_SANITIZE_MAGIC_QUOTES
  • Reflection export() methods
  • mb_strrpos() with encoding as 3rd argument
  • implode() parameter order mix
  • Unbinding $this from non-static closures
  • hebrevc() function
  • convert_cyr_string()
  • money_format()
  • ezmlm_hash()
  • restore_include_path() function
  • allow_url_include

@nikic nikic added the RFC label Jul 11, 2019
@nikic nikic added this to the PHP 7.4 milestone Jul 11, 2019
@nikic nikic force-pushed the deprecations-7.4 branch 2 times, most recently from f915d7e to 087d3fe Compare July 12, 2019 10:56
@nikic nikic changed the title [WIP] Deprecations for PHP 7.4 Deprecations for PHP 7.4 Jul 12, 2019
@nikic nikic force-pushed the deprecations-7.4 branch from 087d3fe to 38476af Compare July 12, 2019 11:29
@nikic
Copy link
Member Author

nikic commented Jul 22, 2019

RFC has been accepted, PR merged.

@nikic nikic closed this Jul 22, 2019
jrfnl added a commit to PHPCompatibility/PHPCompatibility that referenced this pull request Jul 22, 2019
As of PHP 7.4, using the `(real)` type-cast will emit a deprecation notice.
This type-cast is expected to be removed in PHP 8.0.

Refs:
* https://wiki.php.net/rfc/deprecations_php_7_4#the_real_type
* php/php-src#4390
* php/php-src@e41b7f6
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
As of PHP 7.4, the `is_real()` function is deprecated. Use `is_float()` instead.
This function is expected to be removed in PHP 8.0.

Refs:
* https://wiki.php.net/rfc/deprecations_php_7_4#the_real_type
* php/php-src#4390
* php/php-src@4e19069
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 added a commit to PHPCompatibility/PHPCompatibility that referenced this pull request Jul 22, 2019
As of PHP 7.4, the `is_real()` function is deprecated. Use `is_float()` instead.
This function is expected to be removed in PHP 8.0.

Refs:
* https://wiki.php.net/rfc/deprecations_php_7_4#the_real_type
* php/php-src#4390
* php/php-src@4e19069
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 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
As of PHP 7.4, the `is_real()` function is deprecated. Use `is_float()` instead.
This function is expected to be removed in PHP 8.0.

Refs:
* https://wiki.php.net/rfc/deprecations_php_7_4#the_real_type
* php/php-src#4390
* php/php-src@4e19069
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant