Skip to content

Commit

Permalink
- Change redefinition of constructor from E_COMPILE_ERROR to E_STRICT.
Browse files Browse the repository at this point in the history
  • Loading branch information
Andi Gutmans committed Mar 18, 2004
1 parent 2004c25 commit ed6cbcb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Zend/zend_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -997,13 +997,13 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n
/* Improve after RC: cache the lowercase class name */

if ((short_class_name_length == name_len) && (!memcmp(short_class_name, lcname, name_len))) {
if(CG(active_class_entry)->constructor) {
zend_error(E_COMPILE_ERROR, "Cannot redefine constructor for class %s", CG(active_class_entry)->name);
if (CG(active_class_entry)->constructor) {
zend_error(E_STRICT, "Redefining already defined constructor for class %s", CG(active_class_entry)->name);
}
CG(active_class_entry)->constructor = (zend_function *) CG(active_op_array);
} else if ((name_len == sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)))) {
if(CG(active_class_entry)->constructor) {
zend_error(E_COMPILE_ERROR, "Cannot redefine constructor for class %s", CG(active_class_entry)->name);
if (CG(active_class_entry)->constructor) {
zend_error(E_STRICT, "Redefining already defined constructor for class %s", CG(active_class_entry)->name);
}
CG(active_class_entry)->constructor = (zend_function *) CG(active_op_array);
} else if ((name_len == sizeof(ZEND_DESTRUCTOR_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_DESTRUCTOR_FUNC_NAME, sizeof(ZEND_DESTRUCTOR_FUNC_NAME)))) {
Expand Down

0 comments on commit ed6cbcb

Please sign in to comment.