rfc:deprecations_php_8_0
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
rfc:deprecations_php_8_0 [2021/01/15 05:22] – Add unserialize_callback_func INI setting to the list girgias | rfc:deprecations_php_8_0 [2021/02/23 14:37] (current) – nikic | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== PHP RFC: Deprecations for PHP 8.1 ====== | + | ====== PHP RFC: Deprecations for PHP 8.0 ====== |
* Date: 2019-07-23 | * Date: 2019-07-23 | ||
* Author: Nikita Popov < | * Author: Nikita Popov < | ||
* Status: Under Discussion | * Status: Under Discussion | ||
- | ===== Introduction ===== | + | **This RFC was postponed |
- | + | ||
- | The RFC proposes to deprecate the listed functionality in PHP 8.1 and remove it in PHP 9. | + | |
- | + | ||
- | The following list provides a short overview of the functionality targeted for deprecation, | + | |
- | + | ||
- | | + | |
- | | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * Passing bool for '' | + | |
- | * Accessing static members on traits | + | |
- | * '' | + | |
- | * Passing a method name as the first parameter to '' | + | |
- | * '' | + | |
- | * %%'' | + | |
- | * '' | + | |
- | * Return by reference with void type | + | |
- | * NIL constant defined by the IMAP extension | + | |
- | * '' | + | |
- | + | ||
- | ===== Proposal ===== | + | |
- | + | ||
- | Each feature proposed for deprecation is voted separately and requires a 2/3 majority. All votes refer to deprecation in PHP 8.1 and removal in PHP 9.0. | + | |
- | + | ||
- | ==== date_sunrise() and date_sunset() ==== | + | |
- | + | ||
- | These two functions have the signature: | + | |
- | + | ||
- | < | + | |
- | function date_sunset( | + | |
- | int $timestamp, | + | |
- | int $format = SUNFUNCS_RET_STRING, | + | |
- | float $latitude = ini_get(" | + | |
- | float $longitude = ini_get(" | + | |
- | float $zenith = ini_get(" | + | |
- | float $gmt_offset = 0 | + | |
- | ): mixed; | + | |
- | </ | + | |
- | + | ||
- | This function depends on ini settings that specify the " | + | |
- | + | ||
- | '' | + | |
- | + | ||
- | < | + | |
- | function date_sun_info(int $time, float $latitude, float $longitude): | + | |
- | </ | + | |
- | + | ||
- | This function does not use " | + | |
- | + | ||
- | The proposal is to deprecate '' | + | |
- | This was initially discussed in: https:// | + | |
- | + | ||
- | ==== key(), current(), next(), prev(), reset() on objects ==== | + | |
- | + | ||
- | The '' | + | |
- | + | ||
- | This catches many people off guard, because they expect '' | + | |
- | + | ||
- | There are principally two ways to resolve this: The first is to deprecate the use of '' | + | |
- | + | ||
- | As such, the proposal is to deprecate key(), current(), next(), prev() and reset() on objects. The suggested replacement is to cast the object to array first, or call '' | + | |
- | + | ||
- | ==== mb_check_encoding() without argument ==== | + | |
- | + | ||
- | The '' | + | |
- | + | ||
- | > If it is omitted, this function checks all the input from the beginning of the request. | + | |
- | + | ||
- | The implementation says: | + | |
- | + | ||
- | < | + | |
- | /* FIXME: Actually check all inputs, except $_FILES file content. */ | + | |
- | if (MBSTRG(illegalchars) == 0) { | + | |
- | RETURN_TRUE; | + | |
- | } | + | |
- | RETURN_FALSE; | + | |
- | </ | + | |
- | + | ||
- | This %%FIXME%% does not induce a sense of confidence in this function... | + | |
- | + | ||
- | Further research shows that the documentation is correct, in that //any// encoding checking or conversion functionality invoked during a request will increment '' | + | |
- | + | ||
- | Overall this functionality is confusing, and the implementation is unfinished or broken. There are no calls to '' | + | |
- | + | ||
- | The proposal is to deprecate calling '' | + | |
- | + | ||
- | ==== get_class(), | + | |
- | + | ||
- | In PHP 7.2, [[rfc:get_class_disallow_null_parameter|passing null to '' | + | |
- | + | ||
- | The proposal is to deprecate argument-less '' | + | |
- | + | ||
- | As a caveat, if '' | + | |
- | + | ||
- | ==== FILE_BINARY and FILE_TEXT constants ==== | + | |
- | + | ||
- | These were introduced in PHP 5.2.7 for forward compatibility with PHP 6, but don't have any effect. These constants are especially confusing because '' | + | |
- | + | ||
- | The proposal is to deprecate the '' | + | |
- | + | ||
- | This was pointed out in: https:// | + | |
- | + | ||
- | ==== " | + | |
- | + | ||
- | Next to the standard modes, fopen also accepts '' | + | |
- | + | ||
- | > Again, for portability, | + | |
- | + | ||
- | The proposal is to deprecate the use of '' | + | |
- | + | ||
- | There is a complication here: While '' | + | |
- | + | ||
- | ==== Passing bool for $amountOrUpOrDown argument of IntlCalendar:: | + | |
- | + | ||
- | < | + | |
- | + | ||
- | However, it also accepts a boolean argument, in which case '' | + | |
- | + | ||
- | The proposal is to deprecate passing a boolean to this method argument. | + | |
- | + | ||
- | ==== Accessing static members on traits ==== | + | |
- | + | ||
- | Currently, it is possible to directly access static trait members, rather than accessing them on the class using the trait: | + | |
- | + | ||
- | < | + | |
- | trait T { | + | |
- | public static $foo; | + | |
- | } | + | |
- | class C { | + | |
- | use T; | + | |
- | } | + | |
- | var_dump(T:: | + | |
- | </ | + | |
- | + | ||
- | This is conceptually wrong, and causes various complications. For example, the meaning of '' | + | |
- | + | ||
- | There is a somewhat dated analysis of projects using this " | + | |
- | + | ||
- | The proposal is to deprecate the ability to access static properties and static methods directly on traits. | + | |
- | + | ||
- | ==== strftime() and gmstrftime() ==== | + | |
- | + | ||
- | ==== strptime() ==== | + | |
- | + | ||
- | ==== Passing a method name as the first parameter to ReflectionMethod:: | + | |
- | + | ||
- | A '' | + | |
- | + | ||
- | ==== mhash*() function family ==== | + | |
- | + | ||
- | '' | + | |
- | + | ||
- | ==== DatePeriod:: | + | |
- | + | ||
- | This is a heavily overloaded function (it has 3 signatures) which should be deprecated in favour of 3 factory methods. | + | |
- | + | ||
- | ==== ctype_*() function family accepts int parameters ==== | + | |
- | + | ||
- | Although the documentation currently lists '' | + | |
- | + | ||
- | < | + | |
- | If an integer between -128 and 255 inclusive is provided, it is interpreted as the ASCII value of a single character (negative values have 256 added in order to allow characters in the Extended ASCII range). Any other integer is interpreted as a string containing the decimal digits of the integer. | + | |
- | </ | + | |
- | + | ||
- | Moreover, if any other type than int or string is passed, '' | + | |
- | + | ||
- | Since the current behaviour is highly surprising, passing integer values to '' | + | |
- | + | ||
- | ==== Predefined variable $http_response_header ==== | + | |
- | W.I.P. | + | |
- | See https:// | + | |
- | We already deprecated/ | + | |
- | + | ||
- | ==== Return by reference with void type ==== | + | |
- | + | ||
- | '' | + | |
- | + | ||
- | + | ||
- | ==== NIL constant defined by the IMAP extension ==== | + | |
- | The '' | + | |
- | + | ||
- | ==== unserialize_callback_func INI setting ==== | + | |
- | W.I.P. (but from my understanding this was used with __autoload() only - girgias) | + | |
- | + | ||
- | ===== Backward Incompatible Changes ===== | + | |
- | + | ||
- | For PHP 8.1 additional deprecation notices will appear. For PHP 9.0 the previously deprecated functionality will no longer be available. | + | |
- | + | ||
- | ===== Removed from this proposal ===== | + | |
- | + | ||
- | The following entries were originally added to this proposal and then dropped. | + | |
- | + | ||
- | ==== DateTimeInterface:: | + | |
- | + | ||
- | The documentation says: | + | |
- | + | ||
- | > Note: This format is not compatible with ISO-8601, but is left this way for backward compatibility reasons. Use DateTime:: | + | |
- | + | ||
- | There' | + | |
- | + | ||
- | ==== get_browser() function ==== | + | |
- | + | ||
- | This was originally included on the rationale that '' | + |
rfc/deprecations_php_8_0.txt · Last modified: 2021/02/23 14:37 by nikic