mirror of
https://github.com/php/php-src.git
synced 2024-09-29 13:56:09 +00:00
fb346c8f93
conver_to_* functions now accept REFERENCE values, which will be unwrapped before performing the usual conversion. This is consistent with convert_scalar_to_number and matches the expected behavior in a couple random use-sites I checked. Also includes a couple fixes/cleanups elsewhere and two tests for cases that previously didn't work (though the reference issue existed all over the place).
20 lines
386 B
PHP
20 lines
386 B
PHP
--TEST--
|
|
RegexIterator with $replacement being a reference
|
|
--FILE--
|
|
<?php
|
|
$a = new ArrayIterator(array('test1', 'test2', 'test3'));
|
|
$i = new RegexIterator($a, '/^(test)(\d+)/', RegexIterator::REPLACE);
|
|
$r = '$2:$1';
|
|
$i->replacement =& $r;
|
|
var_dump(iterator_to_array($i));
|
|
?>
|
|
--EXPECT--
|
|
array(3) {
|
|
[0]=>
|
|
string(6) "1:test"
|
|
[1]=>
|
|
string(6) "2:test"
|
|
[2]=>
|
|
string(6) "3:test"
|
|
}
|