dmitry Tue Oct 11 02:46:18 2005 EDT Added files: /php-src/ext/pcre/tests bug34790.phpt
Modified files: /php-src/ext/pcre php_pcre.c Log: Fixed bug #34790 (preg_match_all(), named capturing groups, variable assignment/return => crash) http://cvs.php.net/diff.php/php-src/ext/pcre/php_pcre.c?r1=1.170&r2=1.171&ty=u Index: php-src/ext/pcre/php_pcre.c diff -u php-src/ext/pcre/php_pcre.c:1.170 php-src/ext/pcre/php_pcre.c:1.171 --- php-src/ext/pcre/php_pcre.c:1.170 Mon Aug 22 08:22:10 2005 +++ php-src/ext/pcre/php_pcre.c Tue Oct 11 02:46:15 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_pcre.c,v 1.170 2005/08/22 12:22:10 dmitry Exp $ */ +/* $Id: php_pcre.c,v 1.171 2005/10/11 06:46:15 dmitry Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -620,6 +620,7 @@ if (subpat_names[i]) { zend_hash_update(Z_ARRVAL_P(subpats), subpat_names[i], strlen(subpat_names[i])+1, &match_sets[i], sizeof(zval *), NULL); + ZVAL_ADDREF(match_sets[i]); } zend_hash_next_index_insert(Z_ARRVAL_P(subpats), &match_sets[i], sizeof(zval *), NULL); } http://cvs.php.net/co.php/php-src/ext/pcre/tests/bug34790.phpt?r=1.1&p=1 Index: php-src/ext/pcre/tests/bug34790.phpt +++ php-src/ext/pcre/tests/bug34790.phpt --TEST-- Bug #34790 (preg_match_all(), named capturing groups, variable assignment/return => crash) --FILE-- <?php function func1(){ $string = 'what the word and the other word the'; preg_match_all('/(?P<word>the)/', $string, $matches); return $matches['word']; } $words = func1(); var_dump($words); ?> --EXPECT-- array(4) { [0]=> string(3) "the" [1]=> string(3) "the" [2]=> string(3) "the" [3]=> string(3) "the" } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php