cvs: ZendEngine2(PHP_5_3) / zend_compile.c /tests ns_056.phpt
| From: | Dmitry Stogov | Date: | Fri, 09 Nov 2007 13:34:39 +0000 |
| Subject: | cvs: ZendEngine2(PHP_5_3) / zend_compile.c /tests ns_056.phpt | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-6143@lists.php.net to get a copy of this message | ||
dmitry Fri Nov 9 13:34:39 2007 UTC
Added files: (Branch: PHP_5_3)
/ZendEngine2/tests ns_056.phpt
Modified files:
/ZendEngine2 zend_compile.c
Log:
Fixed type-hint compatibility check in namespaces
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_compile.c?r1=1.647.2.27.2.41.2.16&r2=1.647.2.27.2.41.2.17&diff_format=u
Index: ZendEngine2/zend_compile.c
diff -u ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.16
ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.17
--- ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.16 Fri Nov 9 12:15:41 2007
+++ ZendEngine2/zend_compile.c Fri Nov 9 13:34:39 2007
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_compile.c,v 1.647.2.27.2.41.2.16 2007/11/09 12:15:41 dmitry Exp $ */
+/* $Id: zend_compile.c,v 1.647.2.27.2.41.2.17 2007/11/09 13:34:39 dmitry Exp $ */
#include <zend_language_parser.h>
#include "zend.h"
@@ -2176,7 +2176,18 @@
}
if (fe->common.arg_info[i].class_name
&& strcmp(fe->common.arg_info[i].class_name,
proto->common.arg_info[i].class_name)!=0) {
- return 0;
+ char *colon;
+
+ if (fe->common.type == ZEND_USER_FUNCTION &&
+ strchr(proto->common.arg_info[i].class_name, ':') == NULL &&
+ (colon = zend_memrchr(fe->common.arg_info[i].class_name, ':',
fe->common.arg_info[i].class_name_len)) != NULL &&
+ strcmp(colon+1, proto->common.arg_info[i].class_name) == 0) {
+ efree((char*)fe->common.arg_info[i].class_name);
+ fe->common.arg_info[i].class_name = estrndup(proto->common.arg_info[i].class_name,
proto->common.arg_info[i].class_name_len);
+ fe->common.arg_info[i].class_name_len = proto->common.arg_info[i].class_name_len;
+ } else {
+ return 0;
+ }
}
if (fe->common.arg_info[i].array_type_hint != proto->common.arg_info[i].array_type_hint) {
/* Only one has an array type hint and the other one doesn't */
http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/ns_056.phpt?view=markup&rev=1.1
Index: ZendEngine2/tests/ns_056.phpt
+++ ZendEngine2/tests/ns_056.phpt