com php-src: Fixed refcounted handling: ext/standard/array.c

From: Date: Wed, 05 Mar 2014 10:17:16 +0000
Subject: com php-src: Fixed refcounted handling: ext/standard/array.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-77755@lists.php.net to get a copy of this message
Commit: 70b788771243a13bcbdbc930137ae4fd6b446742 Author: Xinchen Hui <laruence@gmail.com> Wed, 5 Mar 2014 18:17:16 +0800 Parents: 74c2deecd8a7854e4cb12ab3e48379cde2c0b19c Branches: phpng Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=70b788771243a13bcbdbc930137ae4fd6b446742 Log: Fixed refcounted handling Changed paths: M ext/standard/array.c Diff: diff --git a/ext/standard/array.c b/ext/standard/array.c index aefaef1..9c741ed 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -411,6 +411,15 @@ static int php_array_natural_general_compare(const void *a, const void *b, int f fval = &f->val; sval = &s->val; + + if (Z_ISREF_P(fval)) { + fval = Z_REFVAL_P(fval); + } + + if (Z_ISREF_P(sval)) { + sval = Z_REFVAL_P(sval); + } + ZVAL_COPY_VALUE(&first, fval); ZVAL_COPY_VALUE(&second, sval); @@ -2605,20 +2614,18 @@ PHP_FUNCTION(array_column) zkeyval = zend_hash_index_find(ht, Z_LVAL_P(zkey)); } - if (zkeyval && Z_TYPE_P(zkeyval) == IS_STRING) { + if (Z_REFCOUNTED_P(zcolval)) { Z_ADDREF_P(zcolval); + } + if (zkeyval && Z_TYPE_P(zkeyval) == IS_STRING) { add_assoc_zval(return_value, Z_STRVAL_P(zkeyval), zcolval); } else if (zkeyval && Z_TYPE_P(zkeyval) == IS_LONG) { add_index_zval(return_value, Z_LVAL_P(zkeyval), zcolval); } else if (zkeyval && Z_TYPE_P(zkeyval) == IS_OBJECT) { - Z_ADDREF_P(zcolval); SEPARATE_ZVAL(zkeyval); convert_to_string(zkeyval); add_assoc_zval(return_value, Z_STRVAL_P(zkeyval), zcolval); } else { - if (Z_REFCOUNTED_P(zcolval)) { - Z_ADDREF_P(zcolval); - } add_next_index_zval(return_value, zcolval); } }

« previous php.cvs (#77755) next »