com php-src: Use extended iteration API to avoid in-place modification: ext/pcre/php_pcre.c

From: Date: Wed, 28 May 2014 08:39:27 +0000
Subject: com php-src: Use extended iteration API to avoid in-place modification: ext/pcre/php_pcre.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-78607@lists.php.net to get a copy of this message
Commit: 2625f145c8881db800402c5e70c74dfa6d7c1cbb Author: Dmitry Stogov <dmitry@zend.com> Wed, 28 May 2014 12:39:27 +0400 Parents: c9062917ebac6d2726360fca6ae3e3ac3a964e0e Branches: phpng Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=2625f145c8881db800402c5e70c74dfa6d7c1cbb Log: Use extended iteration API to avoid in-place modification Changed paths: M ext/pcre/php_pcre.c Diff: diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 952dcb1..193234c 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -1271,6 +1271,7 @@ static zend_string *php_replace_in_subject(zval *regex, zval *replace, zval *sub empty_replace; zend_string *result; zend_string *subject_str = zval_get_string(subject); + HashPosition pos; /* FIXME: This might need to be changed to STR_EMPTY_ALLOC(). Check if this zval could be dtor()'ed somehow */ ZVAL_EMPTY_STRING(&empty_replace); @@ -1279,7 +1280,7 @@ static zend_string *php_replace_in_subject(zval *regex, zval *replace, zval *sub if (Z_TYPE_P(regex) == IS_ARRAY) { replace_value = replace; if (Z_TYPE_P(replace) == IS_ARRAY && !is_callable_replace) - zend_hash_internal_pointer_reset(Z_ARRVAL_P(replace)); + zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(replace), &pos); /* For each entry in the regex array, get the entry */ ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(regex), regex_entry) { @@ -1289,12 +1290,12 @@ static zend_string *php_replace_in_subject(zval *regex, zval *replace, zval *sub /* If replace is an array and not a callable construct */ if (Z_TYPE_P(replace) == IS_ARRAY && !is_callable_replace) { /* Get current entry */ - if ((replace_entry = zend_hash_get_current_data(Z_ARRVAL_P(replace))) != NULL) { + if ((replace_entry = zend_hash_get_current_data_ex(Z_ARRVAL_P(replace), &pos)) != NULL) { if (!is_callable_replace) { convert_to_string_ex(replace_entry); } replace_value = replace_entry; - zend_hash_move_forward(Z_ARRVAL_P(replace)); + zend_hash_move_forward_ex(Z_ARRVAL_P(replace), &pos); } else { /* We've run out of replacement strings, so use an empty one */ replace_value = &empty_replace;

« previous php.cvs (#78607) next »