From c302509726a11d5f79cf04b97a4f2a57bed8a10c Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Wed, 3 Mar 2010 00:15:34 +0000 Subject: [PATCH] - Fixed bug #50731 (Inconsistent namespaces sent to functions registered with spl_autoload_register) --- NEWS | 2 ++ Zend/tests/bug46665.phpt | 2 +- Zend/zend_execute_API.c | 6 +++++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 699910e728..6cfddd517e 100644 --- a/NEWS +++ b/NEWS @@ -96,6 +96,8 @@ PHP NEWS (hiroaki dot kawai at gmail dot com, Ilia) - Fixed bug #50756 (CURLOPT_FTP_SKIP_PASV_IP does not exist). (Sriram) - Fixed bug #50732 (exec() adds single byte twice to $output array). (Ilia) +- Fixed bug #50731 (Inconsistent namespaces sent to functions registered with + spl_autoload_register). (Felipe) - Fixed bug #50728 (All PDOExceptions hardcode 'code' property to 0). (Joey, Ilia) - Fixed bug #50723 (Bug in garbage collector causes crash). (Dmitry) diff --git a/Zend/tests/bug46665.phpt b/Zend/tests/bug46665.phpt index 8e7fc086dd..1f82454387 100644 --- a/Zend/tests/bug46665.phpt +++ b/Zend/tests/bug46665.phpt @@ -12,4 +12,4 @@ function __autoload($class) { ?> --EXPECTF-- -%string|unicode%(12) "\Foo\Bar\Baz" +%string|unicode%(11) "Foo\Bar\Baz" diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index f73df65e2a..55d0ab72ca 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -1076,7 +1076,11 @@ ZEND_API int zend_lookup_class_ex(const char *name, int name_length, int use_aut ALLOC_ZVAL(class_name_ptr); INIT_PZVAL(class_name_ptr); - ZVAL_STRINGL(class_name_ptr, name, name_length, 1); + if (name[0] == '\\') { + ZVAL_STRINGL(class_name_ptr, name+1, name_length-1, 1); + } else { + ZVAL_STRINGL(class_name_ptr, name, name_length, 1); + } args[0] = &class_name_ptr; -- 2.40.0