cvs: ZendEngine2(PHP_5_3) / zend_execute_API.c

[email protected] ("Felipe Pena")
Newsgroups php.zend-engine.cvs
Message-ID <cvsfelipe1227647664@cvsserver>
felipe		Tue Nov 25 21:14:24 2008 UTC

  Modified files:              (Branch: PHP_5_3)
    /ZendEngine2	zend_execute_API.c 
  Log:
  - Fixed bug #46665 (Triggering autoload with a variable classname causes truncated autoload param)
  
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_execute_API.c?r1=1.331.2.20.2.24.2.65&r2=1.331.2.20.2.24.2.66&diff_format=u
Index: ZendEngine2/zend_execute_API.c
diff -u ZendEngine2/zend_execute_API.c:1.331.2.20.2.24.2.65 ZendEngine2/zend_execute_API.c:1.331.2.20.2.24.2.66
--- ZendEngine2/zend_execute_API.c:1.331.2.20.2.24.2.65	Wed Nov 19 02:00:50 2008
+++ ZendEngine2/zend_execute_API.c	Tue Nov 25 21:14:23 2008
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_execute_API.c,v 1.331.2.20.2.24.2.65 2008/11/19 02:00:50 colder Exp $ */
+/* $Id: zend_execute_API.c,v 1.331.2.20.2.24.2.66 2008/11/25 21:14:23 felipe Exp $ */
 
 #include <stdio.h>
 #include <signal.h>
@@ -1006,7 +1006,7 @@
 	zval autoload_function;
 	zval *class_name_ptr;
 	zval *retval_ptr = NULL;
-	int retval;
+	int retval, lc_length;
 	char *lc_name;
 	char *lc_free;
 	zend_fcall_info fcall_info;
@@ -1020,13 +1020,14 @@
 
 	lc_free = lc_name = do_alloca(name_length + 1, use_heap);
 	zend_str_tolower_copy(lc_name, name, name_length);
+	lc_length = name_length + 1;
 
 	if (lc_name[0] == '\\') {
 		lc_name += 1;
-		name_length -= 1;
+		lc_length -= 1;
 	}
 
-	if (zend_hash_find(EG(class_table), lc_name, name_length + 1, (void **) ce) == SUCCESS) {
+	if (zend_hash_find(EG(class_table), lc_name, lc_length, (void **) ce) == SUCCESS) {
 		free_alloca(lc_free, use_heap);
 		return SUCCESS;
 	}
@@ -1044,7 +1045,7 @@
 		zend_hash_init(EG(in_autoload), 0, NULL, NULL, 0);
 	}
 
-	if (zend_hash_add(EG(in_autoload), lc_name, name_length + 1, (void**)&dummy, sizeof(char), NULL) == FAILURE) {
+	if (zend_hash_add(EG(in_autoload), lc_name, lc_length, (void**)&dummy, sizeof(char), NULL) == FAILURE) {
 		free_alloca(lc_free, use_heap);
 		return FAILURE;
 	}
@@ -1081,7 +1082,7 @@
 
 	zval_ptr_dtor(&class_name_ptr);
 
-	zend_hash_del(EG(in_autoload), lc_name, name_length + 1);
+	zend_hash_del(EG(in_autoload), lc_name, lc_length);
 
 	if (retval_ptr) {
 		zval_ptr_dtor(&retval_ptr);
@@ -1092,7 +1093,7 @@
 		return FAILURE;
 	}
 
-	retval = zend_hash_find(EG(class_table), lc_name, name_length + 1, (void **) ce);
+	retval = zend_hash_find(EG(class_table), lc_name, lc_length, (void **) ce);
 	free_alloca(lc_free, use_heap);
 	return retval;
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.