From 0a6e9ddd7fc5020d55b8329760ade7b9b7892528 Mon Sep 17 00:00:00 2001 From: Zeev Suraski Date: Fri, 9 Apr 1999 10:59:58 +0000 Subject: [PATCH] Prevent class redeclarations --- Zend/zend_compile.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 9f4dc4e079..65ffdf30ea 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -1134,7 +1134,9 @@ void do_begin_class_declaration(znode *class_name, znode *parent_class_name CLS_ CG(class_entry).handle_property_set = NULL; CG(class_entry).handle_property_get = NULL; - zend_hash_add(CG(class_table), CG(class_entry).name, CG(class_entry).name_length+1, &CG(class_entry), sizeof(zend_class_entry), (void **) &CG(active_class_entry)); + if (zend_hash_add(CG(class_table), CG(class_entry).name, CG(class_entry).name_length+1, &CG(class_entry), sizeof(zend_class_entry), (void **) &CG(active_class_entry))==FAILURE) { + zend_error(E_COMPILE_ERROR, "Class %s cannot be redeclared", CG(class_entry).name); + } } -- 2.40.0