cvs: ZendEngine2 / zend_compile.c /tests bug44653.phpt

[email protected] ("Dmitry Stogov")
Newsgroups php.zend-engine.cvs
Message-ID <cvsdmitry1207731331@cvsserver>
dmitry		Wed Apr  9 08:55:31 2008 UTC

  Added files:                 
    /ZendEngine2/tests	bug44653.phpt 

  Modified files:              
    /ZendEngine2	zend_compile.c 
  Log:
  Bug #44653 (Invalid namespace name resolution)
  
  
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_compile.c?r1=1.817&r2=1.818&diff_format=u
Index: ZendEngine2/zend_compile.c
diff -u ZendEngine2/zend_compile.c:1.817 ZendEngine2/zend_compile.c:1.818
--- ZendEngine2/zend_compile.c:1.817	Wed Mar 26 14:23:01 2008
+++ ZendEngine2/zend_compile.c	Wed Apr  9 08:55:31 2008
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_compile.c,v 1.817 2008/03/26 14:23:01 scottmac Exp $ */
+/* $Id: zend_compile.c,v 1.818 2008/04/09 08:55:31 dmitry Exp $ */
 
 #include <zend_language_parser.h>
 #include "zend.h"
@@ -1756,17 +1756,9 @@
 			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) ||

http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/bug44653.phpt?view=markup&rev=1.1
Index: ZendEngine2/tests/bug44653.phpt
+++ ZendEngine2/tests/bug44653.phpt
--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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.