rfc:deprecations_php_8_0

PHP RFC: Deprecations for PHP 8.0

Introduction

The RFC proposes to deprecate the listed functionality in PHP 8.0 and remove it in PHP 9.

The following list provides a short overview of the functionality targeted for deprecation, while more detailed explanation is provided in the Proposal section:

  • date_sunrise() and date_sunset()
  • DateTimeInterface::ISO8601/DATE_ISO8601
  • get_browser
  • get_class() without argument

Proposal

Each feature proposed for deprecation is voted separately and requires a 2/3 majority. All votes refer to deprecation in PHP 8.0 and removal in PHP 9.0.

date_sunrise() and date_sunset()

In favor of date_sun_info(). Ini settings date.default_latitude and date.default_longitude will also be removed once the functions are gone. See https://github.com/php/php-src/pull/4423.

DateTimeInterface::ISO8601/DATE_ISO8601

This format is misleading as per the documentation it is actually not compatible with ISO-8601 and DateTime::ATOM/DATE_ATOM should be used instead.

get_browser()

This function is part of the standard library but requires an external dependency (browscap.ini) to work. Moreover, userland implementations are faster than this function. (See user note 122181: http://docs.php.net/manual/en/function.get-browser.php#122181)

nikic: I disagree.

key(), current(), next(), prev(), reset() on objects

tbd

Accessing static members on traits

tbd

Optional param after required

get_class() without argument

WIP

This is rather exotic and is equivalent to using __CLASS__ or self::class which are more explicit as the behaviour could be unexpected within a child class (see example 2 from the documentation page) and the expected behaviour is probably get_called_class()/static::class with LSB.

Backward Incompatible Changes

For PHP 8.0 additional deprecation notices will appear. For PHP 9.0 the previously deprecated functionality will no longer be available.

rfc/deprecations_php_8_0.txt · Last modified: 2020/03/29 17:11 by girgias