felipe                                   Sat, 11 Jun 2011 15:11:49 +0000

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

Log:
- Missing fix for bug #54347

Bug: http://bugs.php.net/54347 (Closed) reflection_extension does not lowercase 
module function name
      
Changed paths:
    U   php/php-src/branches/PHP_5_3/NEWS
    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/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS   2011-06-11 13:31:53 UTC (rev 312051)
+++ php/php-src/branches/PHP_5_3/NEWS   2011-06-11 15:11:49 UTC (rev 312052)
@@ -156,6 +156,10 @@
 - Phar extension:
   . Fixed bug #54395 (Phar::mount() crashes when calling with wrong 
parameters).
     (Felipe)
+
+- Reflection extension:
+  . Fixed bug #54347 (reflection_extension does not lowercase module function
+    name). (Felipe, laruence at yahoo dot com dot cn)

 - SOAP extension:
   . Fixed bug #54312 (soap_version logic bug). (tom at samplonius dot org)

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-11 13:31:53 UTC (rev 312051)
+++ php/php-src/branches/PHP_5_3/ext/reflection/php_reflection.c        
2011-06-11 15:11:49 UTC (rev 312052)
@@ -4854,16 +4854,21 @@

                /* 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;
                        }

                        ALLOC_ZVAL(function);
                        reflection_function_factory(fptr, NULL, function 
TSRMLS_CC);
-                       add_assoc_zval_ex(return_value, func->fname, 
strlen(func->fname)+1, function);
+                       add_assoc_zval_ex(return_value, func->fname, 
fname_len+1, function);
                        func++;
+                       efree(lc_name);
                }
        }
 }

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-11 13:31:53 UTC (rev 312051)
+++ php/php-src/branches/PHP_5_4/ext/reflection/php_reflection.c        
2011-06-11 15:11:49 UTC (rev 312052)
@@ -5097,16 +5097,21 @@

                /* 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;
                        }

                        ALLOC_ZVAL(function);
                        reflection_function_factory(fptr, NULL, function 
TSRMLS_CC);
-                       add_assoc_zval_ex(return_value, func->fname, 
strlen(func->fname)+1, function);
+                       add_assoc_zval_ex(return_value, func->fname, 
fname_len+1, function);
                        func++;
+                       efree(lc_name);
                }
        }
 }

Modified: php/php-src/trunk/ext/reflection/php_reflection.c
===================================================================
--- php/php-src/trunk/ext/reflection/php_reflection.c   2011-06-11 13:31:53 UTC 
(rev 312051)
+++ php/php-src/trunk/ext/reflection/php_reflection.c   2011-06-11 15:11:49 UTC 
(rev 312052)
@@ -5097,16 +5097,21 @@

                /* 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;
                        }

                        ALLOC_ZVAL(function);
                        reflection_function_factory(fptr, NULL, function 
TSRMLS_CC);
-                       add_assoc_zval_ex(return_value, func->fname, 
strlen(func->fname)+1, function);
+                       add_assoc_zval_ex(return_value, func->fname, 
fname_len+1, function);
                        func++;
+                       efree(lc_name);
                }
        }
 }

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

Reply via email to