Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Zend/tests/allow_dynamic_properties_on_interface.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ interface Test {}

?>
--EXPECTF--
Fatal error: Cannot apply #[AllowDynamicProperties] to interface in %s on line %d
Fatal error: Cannot apply #[AllowDynamicProperties] to interface Test in %s on line %d
2 changes: 1 addition & 1 deletion Zend/tests/allow_dynamic_properties_on_trait.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ trait Test {}

?>
--EXPECTF--
Fatal error: Cannot apply #[AllowDynamicProperties] to trait in %s on line %d
Fatal error: Cannot apply #[AllowDynamicProperties] to trait Test in %s on line %d
8 changes: 6 additions & 2 deletions Zend/zend_attributes.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,14 @@ 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");
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");
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",
Expand Down
Loading