[php-src] Issue #21309: Backport #[DelayedTargetValidation] to 8.3 + 8.4

From: Date: Fri, 27 Feb 2026 02:41:01 +0000
Subject: [php-src] Issue #21309: Backport #[DelayedTargetValidation] to 8.3 + 8.4
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-251729@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/21309 Author: kkmuffme ### Description ``` class A { public const XYZ = 'hello'; public string $bar = ''; public function __construct($a) { $this->bar = $a; } } class B extends A { #[DelayedTargetValidation] #[Override] public const XYZ = 'world'; public string $bar = 'asd'; #[DelayedTargetValidation] #[Deprecated] public string $ddd = 'asd'; } $b = new B('a'); echo $b->ddd; ``` This code works in PHP <= 8.2 and >= 8.5 (the Deprecated case in <=8.3 and >= 8.5) since #[DelayedTargetValidation] was only added in 8.5 - creating a gap of 8.3 and 8.4 This means that 2 important (since they're among the first that were implemented) built-in attributes can't be used for many use cases until at least 5 more years (looking at how common PHP 7.4 still is, despite it being unmaintained since years, just like how it was with PHP 5.6 too back then) I'm not familiar if possible at all, but would it theoretically be possible to backport #[DelayedTargetValidation] to also work in 8.3 + 8.4?

« previous php.bugs (#251729) next »