PHP 8.6.0
PHP 8.6.0 was released on November 19, 2026, and it is the first minor release of the 8.6 branch. The PHP development team shipped a sizable batch of language features alongside the usual round of engine fixes: default values for readonly properties, partial function application, the #[\Override] attribute for class constants, __debugInfo() support on enums, and endianness modifiers for pack() and unpack(). Unlike a patch release, 8.6.0 also carries behavior changes that can surface in existing codebases, so a staging run before production is advisable.
Language Features in PHP 8.6.0
Default values for readonly properties
Readonly properties, including those declared inside readonly classes, may now declare a default value. The default counts as the initialization of the property, which means it cannot be written again, not even from the constructor.
class Config {
public readonly int $timeout = 30;
}
$config = new Config();
var_dump($config->timeout); // int(30)
Partial function application
A call in which one or more arguments are replaced by the ? placeholder, or the remaining arguments by ..., now produces a Closure that accepts the missing arguments. The syntax works with userland functions and internal functions alike, which makes it a compact alternative to hand-written wrappers and Closure::fromCallable() factories.
function add(int $a, int $b, int $c = 0): int {
return $a + $b + $c;
}
$addOne = add(1, ?);
var_dump($addOne(5)); // int(6)
$stripSpaces = str_replace(' ', '', ?);
var_dump($stripSpaces('a b c')); // string(3) "abc"
#[\Override] for class constants
The #[\Override] attribute can now be applied to class constants, including enum cases. As with methods and properties, a compile-time error is raised when no matching constant exists in a parent class or implemented interface, which turns a rename in a base class into an immediate failure rather than a silently orphaned constant.
Enums gain __debugInfo()
Enums may now define __debugInfo(). Previously this produced a fatal error, which left enum cases printing as bare names in debugging output. A custom implementation can now expose derived labels, for example a symbol alongside the case name.
WeakMap reference assignment
Reference assignment on a WeakMap no longer requires the key to be present beforehand. Assigning by reference to a missing object key previously raised an Error about the object not being contained in the map.
Mutating objects stored in constants
Objects held in constants or class constants can be mutated directly with OBJ->prop = $val. Expressions that previously failed with "Cannot use temporary expression in write context" now write through to the stored object.
Endianness modifiers for pack() and unpack()
pack() and unpack() accept the < (little-endian) and > (big-endian) modifiers after the s, S, l, L, q and Q integer codes, and after the f and d float and double codes. Binary protocol work no longer needs manual strrev() juggling to force a byte order on a big-endian host.
cURL: size_delivered in curl_getinfo()
The array returned by curl_getinfo() includes a new size_delivered key reporting the total number of bytes passed to the write callback, which is useful when transfers are aborted or resumed.
Behavior Changes That Can Break Code
- By-reference foreach after array compaction: such loops may now visit elements that were previously skipped. Internal pointers on deleted elements move to the next surviving element during copy-on-write.
- Null coalescing and empty() on magic properties:
??andempty()no longer call__get()when__isset()has already materialized the property by writing into the property table. The written value is returned directly. Directisset()checks are unaffected. - array_intersect() string conversion: values are converted to strings while scanning inputs instead of during sort comparisons. The number and order of conversion warnings, the exception reached when
__toString()throws, and results for stateful__toString()implementations can all differ. - Form feed trimmed by default:
\fjoins the default character set oftrim(),rtrim()andltrim(). - New ValueError cases: functions including
array_filter()now raise aValueErrorwhen passed an invalid mode or flag value.
Deprecations to Clean Up Now
- Using
returninside afinallyblock now emits a compile-time deprecation, because it silently swallows exceptions or overwrites return values. - Returning a value from
__construct()or__destruct()is deprecated, as is turning either into a generator withyield. - Declaring a class constant named
namespaceis deprecated; the name is being reserved for a possible::namespacepseudo-constant. - A nullable return type of
?arrayon__debugInfo()is deprecated, since returning null was already deprecated in PHP 8.5. - Naming a function
readonlyis deprecated, and usingletorisas class, function or constant names is now deprecated as well, along with_as a constant name or import alias.
Upgrading
PHP 8.6.0 is available from the official downloads page and through the usual distribution channels; Windows binaries and the source tarballs were published on the release date. The supported release line remains 8.2 through 8.6, so projects on 8.5 still receive bug and security fixes for the remainder of its support window. Before switching production, run the test suite against 8.6 with deprecation notices enabled (error_reporting=E_ALL) so that the finally, constructor return, and reserved-name warnings surface early.
Take particular care with code that relies on trim() preserving form feeds, with array_intersect() calls on objects that implement __toString(), and with by-reference foreach loops that unset elements mid-iteration. Those three changes are the most likely to alter behavior rather than simply raise a notice.