From 92eb129bd9566e45702b74d4372a13baffa92c46 Mon Sep 17 00:00:00 2001 From: Andi Gutmans Date: Mon, 12 Jan 2004 07:15:55 +0000 Subject: - 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 { } } } --- Zend/zend_compile.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index afce4f0084..bec6dee9f3 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -2317,6 +2317,11 @@ void zend_do_begin_class_declaration(znode *class_token, znode *class_name, znod 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); -- cgit v1.2.1