diff options
author | Dmitry Stogov <dmitry@php.net> | 2005-10-21 08:03:28 +0000 |
---|---|---|
committer | Dmitry Stogov <dmitry@php.net> | 2005-10-21 08:03:28 +0000 |
commit | 863bf8a5745489e24c961591d9cb531bd6acba72 (patch) | |
tree | 119285bf8f2b713aba9427c42c32e5ac3970508c | |
parent | d4696abdb932205065006a645d2eb4647c7a6fe9 (diff) | |
download | php-git-863bf8a5745489e24c961591d9cb531bd6acba72.tar.gz |
Fixed bug #29268 (__autoload() not called with Reflection->getClass())
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | Zend/zend_reflection_api.c | 7 | ||||
-rw-r--r-- | ext/reflection/php_reflection.c | 7 | ||||
-rwxr-xr-x | ext/reflection/tests/bug29268.phpt | 26 |
4 files changed, 32 insertions, 10 deletions
@@ -15,6 +15,8 @@ PHP NEWS - Fixed bug #31177 (menory leaks and corruption because of incorrect refcounting). (Dmitry) - Fixed bug #29983 (PHP does not explicitly set mime type & charset). (Ilia) +- Fixed bug #29268 (__autoload() not called with Reflection->getClass()). + (Dmitry) 17 Oct 2005, PHP 5.1 Release Candidate 3 - Fixed bug #34873 (Segmentation Fault on foreach in object). (Dmitry) diff --git a/Zend/zend_reflection_api.c b/Zend/zend_reflection_api.c index 05df2d6fd6..cd56a3213d 100644 --- a/Zend/zend_reflection_api.c +++ b/Zend/zend_reflection_api.c @@ -1740,15 +1740,12 @@ ZEND_METHOD(reflection_parameter, getClass) RETURN_NULL(); } else { zend_class_entry **pce; - char *lcname = do_alloca(param->arg_info->class_name_len + 1); - zend_str_tolower_copy(lcname, param->arg_info->class_name, param->arg_info->class_name_len); - if (zend_hash_find(EG(class_table), lcname, param->arg_info->class_name_len + 1, (void **) &pce) == FAILURE) { - free_alloca(lcname); + + if (zend_lookup_class_ex(param->arg_info->class_name, param->arg_info->class_name_len, 1, &pce TSRMLS_CC) == FAILURE) { zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Class %s does not exist", param->arg_info->class_name); return; } - free_alloca(lcname); zend_reflection_class_factory(*pce, return_value TSRMLS_CC); } } diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 05df2d6fd6..cd56a3213d 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -1740,15 +1740,12 @@ ZEND_METHOD(reflection_parameter, getClass) RETURN_NULL(); } else { zend_class_entry **pce; - char *lcname = do_alloca(param->arg_info->class_name_len + 1); - zend_str_tolower_copy(lcname, param->arg_info->class_name, param->arg_info->class_name_len); - if (zend_hash_find(EG(class_table), lcname, param->arg_info->class_name_len + 1, (void **) &pce) == FAILURE) { - free_alloca(lcname); + + if (zend_lookup_class_ex(param->arg_info->class_name, param->arg_info->class_name_len, 1, &pce TSRMLS_CC) == FAILURE) { zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Class %s does not exist", param->arg_info->class_name); return; } - free_alloca(lcname); zend_reflection_class_factory(*pce, return_value TSRMLS_CC); } } diff --git a/ext/reflection/tests/bug29268.phpt b/ext/reflection/tests/bug29268.phpt new file mode 100755 index 0000000000..d1f74f2e2b --- /dev/null +++ b/ext/reflection/tests/bug29268.phpt @@ -0,0 +1,26 @@ +--TEST-- +Bug #29268 (__autoload() not called with reflectionProperty->getClass()) +--FILE-- +<?php +function __autoload($classname) { + echo "__autoload($classname)\n"; + eval("class $classname {}"); +} + +class B{ + public function doit(A $a){ + } +} + +$ref = new reflectionMethod('B','doit'); +$parameters = $ref->getParameters(); +foreach($parameters as $parameter){ + $class = $parameter->getClass(); + echo $class->name."\n"; +} +echo "ok\n"; +?> +--EXPECT-- +__autoload(A) +A +ok |