dmitry          Wed Jun  8 15:54:25 2005 EDT

  Modified files:              
    /php-src/ext/standard       array.c 
  Log:
  Fixed memory allocation bugs in array_reduce() with initial value (#22463 & 
#24980)
  
  
http://cvs.php.net/diff.php/php-src/ext/standard/array.c?r1=1.299&r2=1.300&ty=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.299 php-src/ext/standard/array.c:1.300
--- php-src/ext/standard/array.c:1.299  Wed May 11 07:43:11 2005
+++ php-src/ext/standard/array.c        Wed Jun  8 15:54:24 2005
@@ -21,7 +21,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: array.c,v 1.299 2005/05/11 11:43:11 andrey Exp $ */
+/* $Id: array.c,v 1.300 2005/06/08 19:54:24 dmitry Exp $ */
 
 #include "php.h"
 #include "php_ini.h"
@@ -4000,8 +4000,11 @@
        efree(callback_name);
 
        if (ZEND_NUM_ARGS() > 2) {
-               convert_to_long_ex(initial);
-               result = *initial;
+               ALLOC_ZVAL(result);
+               *result = **initial;
+               zval_copy_ctor(result);
+               convert_to_long(result);
+               INIT_PZVAL(result);
        } else {
                MAKE_STD_ZVAL(result);
                ZVAL_NULL(result);
@@ -4015,7 +4018,7 @@
        
        if (zend_hash_num_elements(htbl) == 0) {
                if (result) {
-                       RETVAL_ZVAL(result, 1, 0);
+                       RETVAL_ZVAL(result, 1, 1);
                }
                return;
        }

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

Reply via email to