====== PHP RFC: Deprecations for PHP 8.6 ====== * Date: 2025-10-12 * Authors: * Gina Peter Banyard * 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 ==== * Author: Name Description ==== Passing objects for $array parameter of array_walk() and array_walk_recursive() ==== * Author: Gina Peter Banyard 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() ==== * Author: Gina Peter Banyard TODO: Reason to get rid of 'H' ZPP specifier Fallback: get_object_vars() ==== Passing objects to ArrayObject::exchangeArray() ==== * Author: Gina Peter Banyard 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() ==== * Author: Gina Peter Banyard 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 ==== * Author: Gina Peter Banyard 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() ==== Providing invalid values to log() second argument ==== * Author: Alexandre Daubois Providing 1 or any number less or equal to 0 results on a NaN result. This is error-prone. Deprecating then throwing a ValueError in PHP 9.0 would help early error detection and avoid propagating a NaN value. ==== Providing an invalid sorting order to scandir() ==== * Author: Alexandre Daubois Providing an invalid value to the flags of scandir()'s sorting order is currently ignored and falls back to default values. Deprecating such behavior then throwing a ValueError in PHP 9.0 would help error detection and avoid undesired behavior when an invalid value is provided. ==== Providing invalid values to "work" and "blocks" options of the "bzip2.compress" filter ==== * Author: Alexandre Daubois Providing invalid values to the work and blocks options currently silently fails and falls back to default values when using the stream filter bzip2.compress. This may lead to unexpected behavior and difficult error detection. A too low value for work, a too high value for work, a too low value for blocks and a too high value for blocks should be deprecated and will throw a ValueError in PHP 9.0. ===== 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.