]> granicus.if.org Git - php/commitdiff
Fixed bug #26695 (Reflection API does not recognize mixed-case class hints)
authorMarcus Boerger <helly@php.net>
Mon, 22 Dec 2003 20:03:01 +0000 (20:03 +0000)
committerMarcus Boerger <helly@php.net>
Mon, 22 Dec 2003 20:03:01 +0000 (20:03 +0000)
# The exception part

Zend/zend_reflection_api.c
ext/reflection/php_reflection.c

index f2559609edcb4b2b22e38947dd8096973c1dff82..a62b49bd00055595965d4e26c2180a2395bbb989 100644 (file)
@@ -1416,12 +1416,15 @@ ZEND_METHOD(reflection_parameter, getClass)
                RETURN_NULL();
        } else {
                zend_class_entry **pce;
-               
-               if (zend_hash_find(EG(class_table), param->arg_info->class_name, param->arg_info->class_name_len + 1, (void **) &pce) == FAILURE) {
+               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);
                        zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, 
                                "Class %s does not exist", param->arg_info->class_name);
                        return;
                }
+               free_alloca(lcname);
                reflection_class_factory(*pce, return_value TSRMLS_CC);
        }
 }
index f2559609edcb4b2b22e38947dd8096973c1dff82..a62b49bd00055595965d4e26c2180a2395bbb989 100644 (file)
@@ -1416,12 +1416,15 @@ ZEND_METHOD(reflection_parameter, getClass)
                RETURN_NULL();
        } else {
                zend_class_entry **pce;
-               
-               if (zend_hash_find(EG(class_table), param->arg_info->class_name, param->arg_info->class_name_len + 1, (void **) &pce) == FAILURE) {
+               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);
                        zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, 
                                "Class %s does not exist", param->arg_info->class_name);
                        return;
                }
+               free_alloca(lcname);
                reflection_class_factory(*pce, return_value TSRMLS_CC);
        }
 }