colder          Sat Jul 19 13:13:57 2008 UTC

  Modified files:              (Branch: PHP_5_3)
    /php-src/ext/spl    spl_array.c 
  Log:
  MFH: Fix valgrind errors in array_method, and possibly #45349 (Thanks tony 
for the patch)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.13.2.15&r2=1.71.2.17.2.13.2.16&diff_format=u
Index: php-src/ext/spl/spl_array.c
diff -u php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.15 
php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.16
--- php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.15     Sun Jul  6 23:45:55 2008
+++ php-src/ext/spl/spl_array.c Sat Jul 19 13:13:57 2008
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: spl_array.c,v 1.71.2.17.2.13.2.15 2008/07/06 23:45:55 colder Exp $ */
+/* $Id: spl_array.c,v 1.71.2.17.2.13.2.16 2008/07/19 13:13:57 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include "config.h"
@@ -1242,21 +1242,23 @@
 {
        spl_array_object *intern = 
(spl_array_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
        HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC);
-       zval tmp, *arg;
+       zval *tmp, *arg;
        
-       INIT_PZVAL(&tmp);
-       Z_TYPE(tmp) = IS_ARRAY;
-       Z_ARRVAL(tmp) = aht;
+       MAKE_STD_ZVAL(tmp);
+       Z_TYPE_P(tmp) = IS_ARRAY;
+       Z_ARRVAL_P(tmp) = aht;
        
        if (use_arg) {
                if (ZEND_NUM_ARGS() != 1 || 
zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, 
"z", &arg) == FAILURE) {
                        zend_throw_exception(spl_ce_BadMethodCallException, 
"Function expects exactly one argument", 0 TSRMLS_CC);
                        return;
                }
-               zend_call_method(NULL, NULL, NULL, fname, fname_len, 
return_value_ptr, 2, &tmp, arg TSRMLS_CC);
+               zend_call_method(NULL, NULL, NULL, fname, fname_len, 
return_value_ptr, 2, tmp, arg TSRMLS_CC);
        } else {
-               zend_call_method(NULL, NULL, NULL, fname, fname_len, 
return_value_ptr, 1, &tmp, NULL TSRMLS_CC);
+               zend_call_method(NULL, NULL, NULL, fname, fname_len, 
return_value_ptr, 1, tmp, NULL TSRMLS_CC);
        }
+       Z_TYPE_P(tmp) = IS_NULL; /* we want to destroy the zval, not the 
hashtable */
+       zval_ptr_dtor(&tmp);
 } /* }}} */
 
 #define SPL_ARRAY_METHOD(cname, fname, use_arg) \



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

Reply via email to