cvs: ZendEngine2 / zend_compile.c /tests bug42859.phpt ns_029.phpt ns_030.phpt

From: Date: Mon, 12 Nov 2007 17:53:36 +0000
Subject: cvs: ZendEngine2 / zend_compile.c /tests bug42859.phpt ns_029.phpt ns_030.phpt
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-6160@lists.php.net to get a copy of this message
dmitry Mon Nov 12 17:53:36 2007 UTC Modified files: /ZendEngine2 zend_compile.c /ZendEngine2/tests bug42859.phpt ns_029.phpt ns_030.phpt Log: better error messages http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_compile.c?r1=1.782&r2=1.783&diff_format=u Index: ZendEngine2/zend_compile.c diff -u ZendEngine2/zend_compile.c:1.782 ZendEngine2/zend_compile.c:1.783 --- ZendEngine2/zend_compile.c:1.782 Mon Nov 12 16:55:28 2007 +++ ZendEngine2/zend_compile.c Mon Nov 12 17:53:36 2007 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_compile.c,v 1.782 2007/11/12 16:55:28 tony2001 Exp $ */ +/* $Id: zend_compile.c,v 1.783 2007/11/12 17:53:36 dmitry Exp $ */ #include <zend_language_parser.h> #include "zend.h" @@ -3241,7 +3241,7 @@ if (tmp_len != lcname_len || memcmp(tmp.v, lcname.v, UG(unicode)?UBYTES(lcname_len):lcname_len)) { - zend_error(E_COMPILE_ERROR, "Class name '%R' conflicts with import name", Z_TYPE(class_name->u.constant), Z_UNIVAL(class_name->u.constant)); + zend_error(E_COMPILE_ERROR, "Cannot declare class %R because the name is already in use", Z_TYPE(class_name->u.constant), Z_UNIVAL(class_name->u.constant)); } efree(tmp.v); } @@ -5197,7 +5197,7 @@ ZEND_U_EQUAL(Z_TYPE_P(name), lcname, lcname_len, "self", sizeof("self")-1)) || ((lcname_len == sizeof("parent")-1) && ZEND_U_EQUAL(Z_TYPE_P(name), lcname, lcname_len, "parent", sizeof("parent")-1))) { - zend_error(E_COMPILE_ERROR, "Cannot use '%R' as import name", Z_TYPE_P(name), Z_UNIVAL_P(name)); + zend_error(E_COMPILE_ERROR, "Cannot use %R as %R because '%R' is a special class name", Z_TYPE_P(ns), Z_UNIVAL_P(ns), Z_TYPE_P(name), Z_UNIVAL_P(name), Z_TYPE_P(name), Z_UNIVAL_P(name)); } if (CG(current_namespace)) { @@ -5222,7 +5222,7 @@ if (tmp_len != ns_name_len + 2 + lcname_len || memcmp(tmp.v, ns_name.v, UG(unicode)?UBYTES(tmp_len):tmp_len)) { - zend_error(E_COMPILE_ERROR, "Import name '%R' conflicts with defined class", Z_TYPE_P(name), Z_STRVAL_P(name)); + zend_error(E_COMPILE_ERROR, "Cannot use %R as %R because the name is already in use", Z_TYPE_P(ns), Z_UNIVAL_P(ns), Z_TYPE_P(name), Z_UNIVAL_P(name)); } efree(tmp.v); } @@ -5233,13 +5233,13 @@ if (tmp_len != lcname_len || memcmp(tmp.v, lcname.v, UG(unicode)?UBYTES(tmp_len):tmp_len)) { - zend_error(E_COMPILE_ERROR, "Import name '%R' conflicts with defined class", Z_TYPE_P(name), Z_UNIVAL_P(name)); + zend_error(E_COMPILE_ERROR, "Cannot use %R as %R because the name is already in use", Z_TYPE_P(ns), Z_UNIVAL_P(ns), Z_TYPE_P(name), Z_UNIVAL_P(name)); } efree(tmp.v); } if (zend_u_hash_add(CG(current_import), Z_TYPE_P(name), lcname, lcname_len+1, &ns, sizeof(zval*), NULL) != SUCCESS) { - zend_error(E_COMPILE_ERROR, "Cannot reuse import name"); + zend_error(E_COMPILE_ERROR, "Cannot use %R as %R because the name is already in use", Z_TYPE_P(ns), Z_UNIVAL_P(ns), Z_TYPE_P(name), Z_UNIVAL_P(name)); } if (warn) { zend_error(E_WARNING, "The use statement with non-compound name '%R' has no effect", Z_TYPE_P(name), Z_UNIVAL_P(name)); http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/bug42859.phpt?r1=1.3&r2=1.4&diff_format=u Index: ZendEngine2/tests/bug42859.phpt diff -u ZendEngine2/tests/bug42859.phpt:1.3 ZendEngine2/tests/bug42859.phpt:1.4 --- ZendEngine2/tests/bug42859.phpt:1.3 Tue Nov 6 07:29:41 2007 +++ ZendEngine2/tests/bug42859.phpt Mon Nov 12 17:53:36 2007 @@ -9,4 +9,4 @@ use Blah::Ex; ?> --EXPECTF-- -Fatal error: Import name 'Ex' conflicts with defined class in %sbug42859.php on line 6 \ No newline at end of file +Fatal error: Cannot use Blah::Ex as Ex because the name is already in use in %sbug42859.php on line 6 http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/ns_029.phpt?r1=1.3&r2=1.4&diff_format=u Index: ZendEngine2/tests/ns_029.phpt diff -u ZendEngine2/tests/ns_029.phpt:1.3 ZendEngine2/tests/ns_029.phpt:1.4 --- ZendEngine2/tests/ns_029.phpt:1.3 Tue Nov 6 07:29:41 2007 +++ ZendEngine2/tests/ns_029.phpt Mon Nov 12 17:53:36 2007 @@ -9,4 +9,4 @@ new Foo(); --EXPECTF-- -Fatal error: Class name 'Foo' conflicts with import name in %sns_029.php on line 4 +Fatal error: Cannot declare class Foo because the name is already in use in %sns_029.php on line 4 http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/ns_030.phpt?r1=1.3&r2=1.4&diff_format=u Index: ZendEngine2/tests/ns_030.phpt diff -u ZendEngine2/tests/ns_030.phpt:1.3 ZendEngine2/tests/ns_030.phpt:1.4 --- ZendEngine2/tests/ns_030.phpt:1.3 Tue Nov 6 07:29:41 2007 +++ ZendEngine2/tests/ns_030.phpt Mon Nov 12 17:53:36 2007 @@ -9,4 +9,4 @@ new Foo(); --EXPECTF-- -Fatal error: Import name 'Foo' conflicts with defined class in %sns_030.php on line 5 +Fatal error: Cannot use A::B as Foo because the name is already in use in %sns_030.php on line 5

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