Skip to content

Commit 0fc6231

Browse files
AllowDynamicProperties: use fully qualified name in validation errors (#19296)
1 parent 246e8e5 commit 0fc6231

6 files changed

+9
-9
lines changed

Zend/tests/attributes/allow_dynamic_properties_on_enum.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ enum Test {}
88

99
?>
1010
--EXPECTF--
11-
Fatal error: Cannot apply #[AllowDynamicProperties] to enum Test in %s on line %d
11+
Fatal error: Cannot apply #[\AllowDynamicProperties] to enum Test in %s on line %d

Zend/tests/attributes/allow_dynamic_properties_on_interface.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ interface Test {}
88

99
?>
1010
--EXPECTF--
11-
Fatal error: Cannot apply #[AllowDynamicProperties] to interface Test in %s on line %d
11+
Fatal error: Cannot apply #[\AllowDynamicProperties] to interface Test in %s on line %d

Zend/tests/attributes/allow_dynamic_properties_on_trait.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ trait Test {}
88

99
?>
1010
--EXPECTF--
11-
Fatal error: Cannot apply #[AllowDynamicProperties] to trait Test in %s on line %d
11+
Fatal error: Cannot apply #[\AllowDynamicProperties] to trait Test in %s on line %d

Zend/tests/readonly_classes/gh10377_1.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ $readonly_anon = new #[AllowDynamicProperties] readonly class {
1212

1313
?>
1414
--EXPECTF--
15-
Fatal error: Cannot apply #[AllowDynamicProperties] to readonly class class@anonymous in %s on line %d
15+
Fatal error: Cannot apply #[\AllowDynamicProperties] to readonly class class@anonymous in %s on line %d

Zend/tests/readonly_classes/readonly_class_dynamic_property_attribute.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ readonly class Foo
1010

1111
?>
1212
--EXPECTF--
13-
Fatal error: Cannot apply #[AllowDynamicProperties] to readonly class Foo in %s on line %d
13+
Fatal error: Cannot apply #[\AllowDynamicProperties] to readonly class Foo in %s on line %d

Zend/zend_attributes.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,22 +73,22 @@ static void validate_allow_dynamic_properties(
7373
zend_attribute *attr, uint32_t target, zend_class_entry *scope)
7474
{
7575
if (scope->ce_flags & ZEND_ACC_TRAIT) {
76-
zend_error_noreturn(E_ERROR, "Cannot apply #[AllowDynamicProperties] to trait %s",
76+
zend_error_noreturn(E_ERROR, "Cannot apply #[\\AllowDynamicProperties] to trait %s",
7777
ZSTR_VAL(scope->name)
7878
);
7979
}
8080
if (scope->ce_flags & ZEND_ACC_INTERFACE) {
81-
zend_error_noreturn(E_ERROR, "Cannot apply #[AllowDynamicProperties] to interface %s",
81+
zend_error_noreturn(E_ERROR, "Cannot apply #[\\AllowDynamicProperties] to interface %s",
8282
ZSTR_VAL(scope->name)
8383
);
8484
}
8585
if (scope->ce_flags & ZEND_ACC_READONLY_CLASS) {
86-
zend_error_noreturn(E_ERROR, "Cannot apply #[AllowDynamicProperties] to readonly class %s",
86+
zend_error_noreturn(E_ERROR, "Cannot apply #[\\AllowDynamicProperties] to readonly class %s",
8787
ZSTR_VAL(scope->name)
8888
);
8989
}
9090
if (scope->ce_flags & ZEND_ACC_ENUM) {
91-
zend_error_noreturn(E_ERROR, "Cannot apply #[AllowDynamicProperties] to enum %s",
91+
zend_error_noreturn(E_ERROR, "Cannot apply #[\\AllowDynamicProperties] to enum %s",
9292
ZSTR_VAL(scope->name)
9393
);
9494
}

0 commit comments

Comments
 (0)