]> granicus.if.org Git - php/commitdiff
Bug #44653 (Invalid namespace name resolution)
authorDmitry Stogov <dmitry@php.net>
Wed, 9 Apr 2008 08:55:31 +0000 (08:55 +0000)
committerDmitry Stogov <dmitry@php.net>
Wed, 9 Apr 2008 08:55:31 +0000 (08:55 +0000)
Zend/tests/bug44653.phpt [new file with mode: 0644]
Zend/zend_compile.c

diff --git a/Zend/tests/bug44653.phpt b/Zend/tests/bug44653.phpt
new file mode 100644 (file)
index 0000000..defdba8
--- /dev/null
@@ -0,0 +1,26 @@
+--TEST--
+Bug #44653 (Invalid namespace name resolution)
+--FILE--
+<?php
+namespace A;
+const XX=1;
+function fooBar() { echo __FUNCTION__ . PHP_EOL; }
+
+namespace B;
+class A {
+       static function fooBar() { echo "bag1\n"; }     
+}
+class B {
+       static function fooBar() { echo "bag2\n"; }
+}
+function fooBar() { echo __FUNCTION__ . PHP_EOL; }
+var_dump(A::XX);
+A::fooBar();
+fooBar();
+B::fooBar();
+?>
+--EXPECT--
+int(1)
+A::fooBar
+B::fooBar
+B::fooBar
index b821e53650ed5d1d00bacfb2f1b17b454ed6f1e7..193af49c08b3ed7752e54c5f1f32fb96399d7661 100644 (file)
@@ -1756,17 +1756,9 @@ void zend_resolve_class_name(znode *class_name, ulong *fetch_type, int check_ns_
                        zend_class_entry **pce;
 
                        if (check_ns_name) {
-                               unsigned int ns_lcname_len;
-                               zstr ns_lcname = zend_u_str_case_fold(Z_TYPE_P(CG(current_namespace)), Z_UNIVAL_P(CG(current_namespace)), Z_UNILEN_P(CG(current_namespace)), 0, &ns_lcname_len);
-
-                               if (ns_lcname_len == lcname_len &&
-                                   memcmp(lcname.v, ns_lcname.v, UG(unicode)?UBYTES(lcname_len):lcname_len) == 0) {
-                                   /* The given name is equal to name of current namespace.
-                                      PHP will need to perform additional cheks at run-time to
-                                      determine if we assume namespace or class name. */
-                                       *fetch_type |= ZEND_FETCH_CLASS_RT_NS_NAME;
-                               }
-                               efree(ns_lcname.v);
+                           /* PHP will need to perform additional cheks at run-time to
+                              determine if we assume namespace or class name. */
+                               *fetch_type |= ZEND_FETCH_CLASS_RT_NS_NAME;
                        }
 
                        if ((CG(compiler_options) & ZEND_COMPILE_IGNORE_INTERNAL_CLASSES) ||