rfc:deprecations_php_8_6

PHP RFC: Deprecations for PHP 8.6

  • Date: 2025-10-12
  • Authors:
  • Status: Draft
  • Implementation: 8.6
    • TBD

Introduction

The RFC proposes to deprecate the listed functionality in PHP 8.6 and remove it in PHP 9 (except where otherwise noted).

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

  • Passing objects for $array parameter of array_walk() and array_walk_recursive()
  • Passing objects for $options parameter of deflate_init() and inflate_init()
  • Passing objects to ArrayObject::exchangeArray()
  • Deprecate strcoll()
  • Deprecate SORT_LOCALE_STRING flag for sort() functions

Proposal

Each feature proposed for deprecation is voted separately and requires a 2/3 majority. All votes refer to deprecation in PHP 8.6 and removal in PHP 9 (except where otherwise noted).

Example Deprecation

Description

Passing objects for $array parameter of array_walk() and array_walk_recursive()

TODO: Reason to get rid of 'A' ZPP specifier Fallback: get_object_vars()

The recursive version doesn't recursive if a value/property is an object. Due to taking by reference this breaks readonly properties, which is a similar issue that the ArrayObject with backing object deprecation is addressing

Passing objects for $options parameter of deflate_init() and inflate_init()

TODO: Reason to get rid of 'H' ZPP specifier Fallback: get_object_vars()

Passing objects to ArrayObject::exchangeArray()

TODO: Follow-up of 8.5 ArrayObject with objects deprecation https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_arrayobject_and_arrayiterator_with_objects

Deprecate strcoll()

TODO:

  • Not binary safe
  • Relies on global state from setlocale()
  • Alternative: Collator::compare()
  • Deprecate strcoll()
  • Deprecate SORT_LOCALE_STRING

Deprecate SORT_LOCALE_STRING flag for sort() functions

TODO:

  • Not binary safe, as internally it relies on the same behaviour as strcoll
  • Relies on global state from setlocale()
  • Alternative: Collator::sort(), Collator::asort(), Collator::sort(), Collator::sortWithSortKeys()

Backward Incompatible Changes

For PHP 8.6 additional deprecation notices will be emitted. The actual removal of the affected functionality will happen no earlier than PHP 9.

Removed from this proposal

The following entries were originally added to this proposal and then dropped.

rfc/deprecations_php_8_6.txt · Last modified: by girgias