Description
See
|
static void zend_compile_implements(zend_ast *ast) /* {{{ */ |
|
{ |
|
zend_ast_list *list = zend_ast_get_list(ast); |
|
zend_class_entry *ce = CG(active_class_entry); |
|
zend_class_name *interface_names; |
|
uint32_t i; |
|
|
|
interface_names = emalloc(sizeof(zend_class_name) * list->children); |
|
|
|
for (i = 0; i < list->children; ++i) { |
|
zend_ast *class_ast = list->child[i]; |
|
interface_names[i].name = |
|
zend_resolve_const_class_name_reference(class_ast, "interface name"); |
|
interface_names[i].lc_name = zend_string_tolower(interface_names[i].name); |
|
} |
|
|
|
ce->num_interfaces = list->children; |
|
ce->interface_names = interface_names; |
|
} |
If an attribute validator added an interface to the class, it gets silently dropped and triggers leaks, because class attributes are compiled before implements, see
|
if (decl->child[3]) { |
|
zend_compile_attributes(&ce->attributes, decl->child[3], 0, ZEND_ATTRIBUTE_TARGET_CLASS, 0); |
|
} |
|
|
|
if (implements_ast) { |
|
zend_compile_implements(implements_ast); |
|
} |
Discovered while working on https://github.com/DanielEScherzer/CustomCast, not sure if I noticed this earlier and just didn't report it but it has been there for a while
PHP Version
Operating System
No response
Description
See
php-src/Zend/zend_compile.c
Lines 8959 to 8977 in b0c7865
If an attribute validator added an interface to the class, it gets silently dropped and triggers leaks, because class attributes are compiled before implements, see
php-src/Zend/zend_compile.c
Lines 9110 to 9116 in b0c7865
Discovered while working on https://github.com/DanielEScherzer/CustomCast, not sure if I noticed this earlier and just didn't report it but it has been there for a while
PHP Version
Operating System
No response