helly           Wed Dec 21 20:05:24 2005 EDT

  Modified files:              (Branch: PHP_5_1)
    /php-src/ext/spl    php_spl.c 
  Log:
  - We need to store the length of the class name
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/php_spl.c?r1=1.52.2.23&r2=1.52.2.24&diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.52.2.23 php-src/ext/spl/php_spl.c:1.52.2.24
--- php-src/ext/spl/php_spl.c:1.52.2.23 Sun Dec 18 15:46:46 2005
+++ php-src/ext/spl/php_spl.c   Wed Dec 21 20:05:24 2005
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_spl.c,v 1.52.2.23 2005/12/18 15:46:46 zeev Exp $ */
+/* $Id: php_spl.c,v 1.52.2.24 2005/12/21 20:05:24 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
        #include "config.h"
@@ -341,6 +341,7 @@
 PHP_FUNCTION(spl_autoload_call)
 {
        zval **class_name, *retval = NULL;
+       int class_name_len;
        char *func_name, *lc_name;
        uint func_name_len;
        ulong dummy;
@@ -352,7 +353,8 @@
        }
 
        if (SPL_G(autoload_functions)) {
-               lc_name = zend_str_tolower_dup(Z_STRVAL_PP(class_name), 
Z_STRLEN_PP(class_name));
+               class_name_len = Z_STRLEN_PP(class_name);
+               lc_name = zend_str_tolower_dup(Z_STRVAL_PP(class_name), 
class_name_len);
                zend_hash_internal_pointer_reset_ex(SPL_G(autoload_functions), 
&function_pos);
                while(zend_hash_has_more_elements_ex(SPL_G(autoload_functions), 
&function_pos) == SUCCESS && !EG(exception)) {
                        zend_hash_get_current_key_ex(SPL_G(autoload_functions), 
&func_name, &func_name_len, &dummy, 0, &function_pos);
@@ -361,7 +363,7 @@
                        if (retval) {
                                zval_ptr_dtor(&retval);                         
        
                        }
-                       if (zend_hash_exists(EG(class_table), lc_name, 
Z_STRLEN_PP(class_name)+1)) {
+                       if (zend_hash_exists(EG(class_table), lc_name, 
class_name_len + 1)) {
                                break;
                        }
                        zend_hash_move_forward_ex(SPL_G(autoload_functions), 
&function_pos);

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

Reply via email to