felipe                                   Thu, 09 Jun 2011 22:45:35 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=311990

Log:
- Fixed bug #54347 (reflection_extension does not lowercase module function 
name)
  patch by: laruence at yahoo dot com dot cn

Bug: http://bugs.php.net/54347 (Open) reflection_extension does not lowercase 
module function name
      
Changed paths:
    U   php/php-src/branches/PHP_5_3/ext/reflection/php_reflection.c
    U   php/php-src/branches/PHP_5_4/ext/reflection/php_reflection.c
    U   php/php-src/trunk/ext/reflection/php_reflection.c

Modified: php/php-src/branches/PHP_5_3/ext/reflection/php_reflection.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/reflection/php_reflection.c        
2011-06-09 22:08:32 UTC (rev 311989)
+++ php/php-src/branches/PHP_5_3/ext/reflection/php_reflection.c        
2011-06-09 22:45:35 UTC (rev 311990)
@@ -1085,13 +1085,18 @@

                /* Is there a better way of doing this? */
                while (func->fname) {
-                       if (zend_hash_find(EG(function_table), func->fname, 
strlen(func->fname) + 1, (void**) &fptr) == FAILURE) {
+                       int fname_len = strlen(func->fname);
+                       char *lc_name = zend_str_tolower_dup(func->fname, 
fname_len);
+
+                       if (zend_hash_find(EG(function_table), lc_name, 
fname_len+1, (void**) &fptr) == FAILURE) {
                                php_error_docref(NULL TSRMLS_CC, E_WARNING, 
"Internal error: Cannot find extension function %s in global function table", 
func->fname);
                                func++;
+                               efree(lc_name);
                                continue;
                        }

                        _function_string(str, fptr, NULL, "    " TSRMLS_CC);
+                       efree(lc_name);
                        func++;
                }
                string_printf(str, "%s  }\n", indent);

Modified: php/php-src/branches/PHP_5_4/ext/reflection/php_reflection.c
===================================================================
--- php/php-src/branches/PHP_5_4/ext/reflection/php_reflection.c        
2011-06-09 22:08:32 UTC (rev 311989)
+++ php/php-src/branches/PHP_5_4/ext/reflection/php_reflection.c        
2011-06-09 22:45:35 UTC (rev 311990)
@@ -1111,13 +1111,18 @@

                /* Is there a better way of doing this? */
                while (func->fname) {
-                       if (zend_hash_find(EG(function_table), func->fname, 
strlen(func->fname) + 1, (void**) &fptr) == FAILURE) {
+                       int fname_len = strlen(func->fname);
+                       char *lc_name = zend_str_tolower_dup(func->fname, 
fname_len);
+
+                       if (zend_hash_find(EG(function_table), lc_name, 
fname_len + 1, (void**) &fptr) == FAILURE) {
                                php_error_docref(NULL TSRMLS_CC, E_WARNING, 
"Internal error: Cannot find extension function %s in global function table", 
func->fname);
                                func++;
+                               efree(lc_name);
                                continue;
                        }

                        _function_string(str, fptr, NULL, "    " TSRMLS_CC);
+                       efree(lc_name);
                        func++;
                }
                string_printf(str, "%s  }\n", indent);

Modified: php/php-src/trunk/ext/reflection/php_reflection.c
===================================================================
--- php/php-src/trunk/ext/reflection/php_reflection.c   2011-06-09 22:08:32 UTC 
(rev 311989)
+++ php/php-src/trunk/ext/reflection/php_reflection.c   2011-06-09 22:45:35 UTC 
(rev 311990)
@@ -1111,13 +1111,18 @@

                /* Is there a better way of doing this? */
                while (func->fname) {
-                       if (zend_hash_find(EG(function_table), func->fname, 
strlen(func->fname) + 1, (void**) &fptr) == FAILURE) {
+                       int fname_len = strlen(func->fname);
+                       char *lc_name = zend_str_tolower_dup(func->fname, 
fname_len);
+
+                       if (zend_hash_find(EG(function_table), lc_name, 
fname_len + 1, (void**) &fptr) == FAILURE) {
                                php_error_docref(NULL TSRMLS_CC, E_WARNING, 
"Internal error: Cannot find extension function %s in global function table", 
func->fname);
                                func++;
+                               efree(lc_name);
                                continue;
                        }

                        _function_string(str, fptr, NULL, "    " TSRMLS_CC);
+                       efree(lc_name);
                        func++;
                }
                string_printf(str, "%s  }\n", indent);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to