Skip to content

Commit 3026c9e

Browse files
UPGRADING
1 parent f1f5bea commit 3026c9e

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

UPGRADING

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ PHP 8.5 UPGRADE NOTES
5353
. Applying #[\Attribute] to an abstract class, enum, interface, or trait triggers
5454
an error during compilation. Previously, the attribute could be added, but when
5555
ReflectionAttribute::newInstance() was called an error would be thrown.
56+
The error can be delayed from compilation to runtime using the new
57+
#[\DelayedTargetValidation] attribute.
5658

5759
- DOM:
5860
. Cloning a DOMNamedNodeMap, DOMNodeList, Dom\NamedNodeMap, Dom\NodeList,
@@ -184,6 +186,11 @@ PHP 8.5 UPGRADE NOTES
184186
RFC: https://wiki.php.net/rfc/final_promotion
185187
. #[\Override] can now be applied to properties.
186188
RFC: https://wiki.php.net/rfc/override_properties
189+
. The #[\DelayedTargetValidation] attribute can be used to suppress
190+
compile-time errors from core (or extension) attributes that are used on
191+
invalid targets. These errors are instead reported at runtime if and when
192+
ReflectionAttribute::newInstance() is called.
193+
RFC: https://wiki.php.net/rfc/delayedtargetvalidation_attribute
187194

188195
- Curl:
189196
. Added support for share handles that are persisted across multiple PHP
@@ -521,6 +528,11 @@ PHP 8.5 UPGRADE NOTES
521528
hooks are final, and whether the property is virtual. This also affects
522529
the output of ReflectionClass::__toString() when a class contains hooked
523530
properties.
531+
. ReflectionAttribute::newInstance() can now throw errors for internal
532+
attributes if the attribute was applied on an invalid target and the
533+
error was delayed from compile-time to runtime via the
534+
#[\DelayedTargetValidation] attribute.
535+
RFC: https://wiki.php.net/rfc/delayedtargetvalidation_attribute
524536

525537
- Session:
526538
. session_start is stricter in regard to the option argument.
@@ -641,6 +653,10 @@ PHP 8.5 UPGRADE NOTES
641653
- Core:
642654
. NoDiscard attribute was added.
643655
RFC: https://wiki.php.net/rfc/marking_return_value_as_important
656+
. DelayedTargetValidation is an attribute that, when added, delays any errors
657+
from *other* internal attributes about being applied to invalid targets from
658+
compile-time to runtime.
659+
RFC: https://wiki.php.net/rfc/delayedtargetvalidation_attribute
644660

645661
- Curl:
646662
. CurlSharePersistentHandle representing a share handle that is persisted

UPGRADING.INTERNALS

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,18 @@ PHP 8.5 INTERNALS UPGRADE NOTES
2828
extra layer of indirection can be removed. In other cases a zval can
2929
be heap-allocated and stored in the pointer as a minimal change to keep
3030
compatibility.
31+
. The `target` parameter for validator callbacks for internal attributes
32+
can now include in the bitmask the new flags
33+
ZEND_ATTRIBUTE_NO_TARGET_VALIDATION and
34+
ZEND_ATTRIBUTE_DELAYED_TARGET_VALIDATION. The first indicates that, if the
35+
attribute is being applied to an invalid target, no error should be thrown
36+
at compile time. The second indicates that validation is being performed
37+
at runtime and that if an attribute is being applied to an invalid target,
38+
a catchable error should be thrown. Target validation is different from
39+
the actual functionality of the attribute; e.g. the #[\Override] attribute
40+
will trigger an error if the function does not override a method from the
41+
parent class or from an interface; that error does not get delayed.
42+
RFC: https://wiki.php.net/rfc/delayedtargetvalidation_attribute
3143

3244
- Hash
3345
. Hash functions now use proper hash_spec_result enum for return values

0 commit comments

Comments
 (0)