From 6b5d2c8e412ef7eb1fc3282520385e5e6464943d 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) --- Zend/tests/bug46665.phpt | 2 +- Zend/zend_execute_API.c | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) 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 c7a5928778..ba93b5317d 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -1070,7 +1070,7 @@ ZEND_API int zend_u_lookup_class_ex(zend_uchar type, zstr name, int name_length, zval *retval_ptr = NULL; int retval; unsigned int lc_name_len; - zstr lc_name, lc_free; + zstr lc_name, lc_free, name_p; char dummy = 1; zend_fcall_info fcall_info; zend_fcall_info_cache fcall_cache; @@ -1133,7 +1133,15 @@ ZEND_API int zend_u_lookup_class_ex(zend_uchar type, zstr name, int name_length, ALLOC_ZVAL(class_name_ptr); INIT_PZVAL(class_name_ptr); - ZVAL_ZSTRL(class_name_ptr, type, autoload_name, name_length, 1); + name_p.v = autoload_name.v; + if (name_length != lc_name_len) { + if (type == IS_UNICODE) { + name_p.u++; + } else if (type == IS_STRING) { + name_p.s++; + } + } + ZVAL_ZSTRL(class_name_ptr, type, name_p, lc_name_len, 1); args[0] = &class_name_ptr; -- 2.40.0