Bug #50579 [Com]: RegexIterator::REPLACE doesn't work
| From: | jinmoku at hotmail dot com | Date: | Sun, 11 Jul 2010 03:31:39 +0000 |
| Subject: | Bug #50579 [Com]: RegexIterator::REPLACE doesn't work | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-152263@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=50579&edit=1
ID: 50579
Comment by: jinmoku at hotmail dot com
Reported by: team at fazend dot com
Summary: RegexIterator::REPLACE doesn't work
Status: Verified
Type: Bug
Package: SPL related
Operating System: *
PHP Version: 5.*, 6
New Comment:
In original doc (http://www.php.net/~helly/php/ext/spl/),
RegexIterator::REPLACE wait for "replacement" property, but it's doesn't
exist in __construct and properties.
In ext/spl replacement exist as public property but not in __construct
method, so I try to extends it like this
public function __construct($iterator, $regex, $mode = 0, $flags = 0,
$preg_flags = 0)
{
parent::__construct($iterator, $regex, $mode, $flags, $preg_flags);
$this->replacement = '$1';
}
but nothing append to :(
Previous Comments:
------------------------------------------------------------------------
[2009-12-29 15:04:20] jani@php.net
Seems like this thing never got finished. There aren't any tests for it
either..
------------------------------------------------------------------------
[2009-12-26 13:18:29] team at fazend dot com
Description:
------------
RegexIterator::REPLACE doesn't work as it is supposed to do. The code
example attached should return something, but it returns nothing.
Reproduce code:
---------------
$i = new RegexIterator(
new ArrayIterator(array(
'test1'=>'test888',
'test2'=>'what?',
'test3'=>'test999')),
'/^test(.*)/',
RegexIterator::REPLACE);
foreach ($i as $name=>$value)
echo $name . '=>' . $value . "\n";
Expected result:
----------------
888
999
Actual result:
--------------
nothing
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=50579&edit=1