cvs: ZendEngine2 / zend_compile.c

From: Date: Mon, 12 Jan 2004 07:15:55 +0000
Subject: cvs: ZendEngine2 / zend_compile.c
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-2207@lists.php.net to get a copy of this message
andi Mon Jan 12 02:15:55 2004 EDT Modified files: /ZendEngine2 zend_compile.c Log: - Return the PHP 4 behavior of not allowing class declerations within - class declerations. This happened when declaring a class within a - method. class A { function foo() { class B { } } } Index: ZendEngine2/zend_compile.c diff -u ZendEngine2/zend_compile.c:1.512 ZendEngine2/zend_compile.c:1.513 --- ZendEngine2/zend_compile.c:1.512 Sun Jan 11 16:39:40 2004 +++ ZendEngine2/zend_compile.c Mon Jan 12 02:15:55 2004 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_compile.c,v 1.512 2004/01/11 21:39:40 wez Exp $ */ +/* $Id: zend_compile.c,v 1.513 2004/01/12 07:15:55 andi Exp $ */ #include "zend_language_parser.h" #include "zend.h" @@ -2317,6 +2317,11 @@ zend_class_entry *new_class_entry = emalloc(sizeof(zend_class_entry)); char *lcname = zend_str_tolower_dup(class_name->u.constant.value.str.val, class_name->u.constant.value.str.len); + if (CG(active_class_entry)) { + zend_error(E_COMPILE_ERROR, "Class declarations may not be nested"); + return; + } + if (!(strcmp(lcname, "self") && strcmp(lcname, "parent"))) { efree(lcname); zend_error(E_COMPILE_ERROR, "Cannot use '%s' as class name as it is reserved", class_name->u.constant.value.str.val);

« previous php.zend-engine.cvs (#2207) next »