felipe Mon, 08 Nov 2010 20:26:14 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=305211
Log: - Fix the fix (wrong behavior) Changed paths: U php/php-src/branches/PHP_5_3/ext/spl/spl_iterators.c U php/php-src/branches/PHP_5_3/ext/spl/tests/bug50579.phpt U php/php-src/trunk/ext/spl/spl_iterators.c U php/php-src/trunk/ext/spl/tests/bug50579.phpt Modified: php/php-src/branches/PHP_5_3/ext/spl/spl_iterators.c =================================================================== --- php/php-src/branches/PHP_5_3/ext/spl/spl_iterators.c 2010-11-08 18:41:03 UTC (rev 305210) +++ php/php-src/branches/PHP_5_3/ext/spl/spl_iterators.c 2010-11-08 20:26:14 UTC (rev 305211) @@ -1796,7 +1796,7 @@ break; case REGIT_MODE_REPLACE: - replacement = zend_read_property(intern->std.ce, intern->inner.zobject, "replacement", sizeof("replacement")-1, 1 TSRMLS_CC); + replacement = zend_read_property(intern->std.ce, getThis(), "replacement", sizeof("replacement")-1, 1 TSRMLS_CC); result = php_pcre_replace_impl(intern->u.regex.pce, subject, subject_len, replacement, 0, &result_len, -1, &count TSRMLS_CC); if (intern->u.regex.flags & REGIT_USE_KEY) { Modified: php/php-src/branches/PHP_5_3/ext/spl/tests/bug50579.phpt =================================================================== --- php/php-src/branches/PHP_5_3/ext/spl/tests/bug50579.phpt 2010-11-08 18:41:03 UTC (rev 305210) +++ php/php-src/branches/PHP_5_3/ext/spl/tests/bug50579.phpt 2010-11-08 20:26:14 UTC (rev 305211) @@ -9,23 +9,23 @@ 'test1'=>'test888', 'test2'=>'what?', 'test3'=>'test999')); - $this->replacement = '[$1]'; } } $h = new foo; $i = new RegexIterator($h, '/^test(.*)/', RegexIterator::REPLACE); -$h->replacement = '[$0]'; +$i->replacement = '[$0]'; foreach ($i as $name=>$value) { echo $name . '=>' . $value . "\n"; } -$h->replacement = '$1'; +$i->replacement = '$1'; foreach ($i as $name=>$value) { echo $name . '=>' . $value . "\n"; } $h = new foo; $i = new RegexIterator($h, '/^test(.*)/', RegexIterator::REPLACE); +$i->replacement = '[$1]'; foreach ($i as $name=>$value) { echo $name . '=>' . $value . "\n"; } Modified: php/php-src/trunk/ext/spl/spl_iterators.c =================================================================== --- php/php-src/trunk/ext/spl/spl_iterators.c 2010-11-08 18:41:03 UTC (rev 305210) +++ php/php-src/trunk/ext/spl/spl_iterators.c 2010-11-08 20:26:14 UTC (rev 305211) @@ -1795,7 +1795,7 @@ break; case REGIT_MODE_REPLACE: - replacement = zend_read_property(intern->std.ce, intern->inner.zobject, "replacement", sizeof("replacement")-1, 1 TSRMLS_CC); + replacement = zend_read_property(intern->std.ce, getThis(), "replacement", sizeof("replacement")-1, 1 TSRMLS_CC); result = php_pcre_replace_impl(intern->u.regex.pce, subject, subject_len, replacement, 0, &result_len, -1, &count TSRMLS_CC); if (intern->u.regex.flags & REGIT_USE_KEY) { Modified: php/php-src/trunk/ext/spl/tests/bug50579.phpt =================================================================== --- php/php-src/trunk/ext/spl/tests/bug50579.phpt 2010-11-08 18:41:03 UTC (rev 305210) +++ php/php-src/trunk/ext/spl/tests/bug50579.phpt 2010-11-08 20:26:14 UTC (rev 305211) @@ -9,23 +9,23 @@ 'test1'=>'test888', 'test2'=>'what?', 'test3'=>'test999')); - $this->replacement = '[$1]'; } } $h = new foo; $i = new RegexIterator($h, '/^test(.*)/', RegexIterator::REPLACE); -$h->replacement = '[$0]'; +$i->replacement = '[$0]'; foreach ($i as $name=>$value) { echo $name . '=>' . $value . "\n"; } -$h->replacement = '$1'; +$i->replacement = '$1'; foreach ($i as $name=>$value) { echo $name . '=>' . $value . "\n"; } $h = new foo; $i = new RegexIterator($h, '/^test(.*)/', RegexIterator::REPLACE); +$i->replacement = '[$1]'; foreach ($i as $name=>$value) { echo $name . '=>' . $value . "\n"; }
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php