1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

AllowDynamicProperties: use fully qualified name in validation errors (#19296)

This commit is contained in:
Daniel Scherzer
2025-07-30 14:50:40 -07:00
committed by GitHub
parent 246e8e53ba
commit 0fc62310b1
6 changed files with 9 additions and 9 deletions

View File

@@ -8,4 +8,4 @@ enum Test {}
?>
--EXPECTF--
Fatal error: Cannot apply #[AllowDynamicProperties] to enum Test in %s on line %d
Fatal error: Cannot apply #[\AllowDynamicProperties] to enum Test in %s on line %d

View File

@@ -8,4 +8,4 @@ interface Test {}
?>
--EXPECTF--
Fatal error: Cannot apply #[AllowDynamicProperties] to interface Test in %s on line %d
Fatal error: Cannot apply #[\AllowDynamicProperties] to interface Test in %s on line %d

View File

@@ -8,4 +8,4 @@ trait Test {}
?>
--EXPECTF--
Fatal error: Cannot apply #[AllowDynamicProperties] to trait Test in %s on line %d
Fatal error: Cannot apply #[\AllowDynamicProperties] to trait Test in %s on line %d

View File

@@ -12,4 +12,4 @@ $readonly_anon = new #[AllowDynamicProperties] readonly class {
?>
--EXPECTF--
Fatal error: Cannot apply #[AllowDynamicProperties] to readonly class class@anonymous in %s on line %d
Fatal error: Cannot apply #[\AllowDynamicProperties] to readonly class class@anonymous in %s on line %d

View File

@@ -10,4 +10,4 @@ readonly class Foo
?>
--EXPECTF--
Fatal error: Cannot apply #[AllowDynamicProperties] to readonly class Foo in %s on line %d
Fatal error: Cannot apply #[\AllowDynamicProperties] to readonly class Foo in %s on line %d

View File

@@ -73,22 +73,22 @@ static void validate_allow_dynamic_properties(
zend_attribute *attr, uint32_t target, zend_class_entry *scope)
{
if (scope->ce_flags & ZEND_ACC_TRAIT) {
zend_error_noreturn(E_ERROR, "Cannot apply #[AllowDynamicProperties] to trait %s",
zend_error_noreturn(E_ERROR, "Cannot apply #[\\AllowDynamicProperties] to trait %s",
ZSTR_VAL(scope->name)
);
}
if (scope->ce_flags & ZEND_ACC_INTERFACE) {
zend_error_noreturn(E_ERROR, "Cannot apply #[AllowDynamicProperties] to interface %s",
zend_error_noreturn(E_ERROR, "Cannot apply #[\\AllowDynamicProperties] to interface %s",
ZSTR_VAL(scope->name)
);
}
if (scope->ce_flags & ZEND_ACC_READONLY_CLASS) {
zend_error_noreturn(E_ERROR, "Cannot apply #[AllowDynamicProperties] to readonly class %s",
zend_error_noreturn(E_ERROR, "Cannot apply #[\\AllowDynamicProperties] to readonly class %s",
ZSTR_VAL(scope->name)
);
}
if (scope->ce_flags & ZEND_ACC_ENUM) {
zend_error_noreturn(E_ERROR, "Cannot apply #[AllowDynamicProperties] to enum %s",
zend_error_noreturn(E_ERROR, "Cannot apply #[\\AllowDynamicProperties] to enum %s",
ZSTR_VAL(scope->name)
);
}