com php-src: Fixed reference support: ext/pcre/php_pcre.c
| From: | Dmitry Stogov | Date: | Wed, 16 Apr 2014 08:08:16 +0000 |
| Subject: | com php-src: Fixed reference support: ext/pcre/php_pcre.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-77385@lists.php.net to get a copy of this message | ||
Commit: 81b24d4100bf229844e4980c79f27763827f10d2
Author: Dmitry Stogov <dmitry@zend.com> Wed, 16 Apr 2014 12:08:16 +0400
Parents: 10824893027fa91faa2818212d4b902a5e2116ad
Branches: phpng
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=81b24d4100bf229844e4980c79f27763827f10d2
Log:
Fixed reference support
Changed paths:
M ext/pcre/php_pcre.c
Diff:
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
index 1527fff..a38c5cd 100644
--- a/ext/pcre/php_pcre.c
+++ b/ext/pcre/php_pcre.c
@@ -1783,10 +1783,9 @@ PHPAPI void php_pcre_grep_impl(pcre_cache_entry *pce, zval *input, zval
*return
/* Go through the input array */
zend_hash_internal_pointer_reset(Z_ARRVAL_P(input));
while ((entry = zend_hash_get_current_data(Z_ARRVAL_P(input))) != NULL) {
- zval subject, *ref_entry = NULL;
+ zval subject, *ref_entry = entry;
if (Z_ISREF_P(entry)) {
- ref_entry = entry;
entry = Z_REFVAL_P(entry);
}
@@ -1814,22 +1813,19 @@ PHPAPI void php_pcre_grep_impl(pcre_cache_entry *pce, zval *input, zval
*return
/* If the entry fits our requirements */
if ((count > 0 && !invert) || (count == PCRE_ERROR_NOMATCH && invert)) {
- if (ref_entry) {
+ if (Z_REFCOUNTED_P(ref_entry)) {
Z_ADDREF_P(ref_entry);
- entry = ref_entry;
- } else if (Z_REFCOUNTED_P(entry)) {
- Z_ADDREF_P(entry);
}
/* Add to return array */
switch (zend_hash_get_current_key(Z_ARRVAL_P(input), &string_key, &num_key, 0))
{
case HASH_KEY_IS_STRING:
- zend_hash_update(Z_ARRVAL_P(return_value), string_key, entry);
+ zend_hash_update(Z_ARRVAL_P(return_value), string_key, ref_entry);
break;
case HASH_KEY_IS_LONG:
- zend_hash_index_update(Z_ARRVAL_P(return_value), num_key, entry);
+ zend_hash_index_update(Z_ARRVAL_P(return_value), num_key, ref_entry);
break;
}
}