Edit report at http://bugs.php.net/bug.php?id=53659&edit=1

 ID:                 53659
 Updated by:         ahar...@php.net
 Reported by:        jthijssen at noxlogic dot nl
 Summary:            Implementing RegexIterator::getRegex() method
-Status:             Open
+Status:             Assigned
 Type:               Feature/Change Request
 Package:            SPL related
 Operating System:   All
 PHP Version:        5.3SVN-2011-01-05 (SVN)
-Assigned To:        
+Assigned To:        aharvey
 Block user comment: N
 Private report:     N

 New Comment:

Looks good at a first pass. Let's see about getting it into trunk.


Previous Comments:
------------------------------------------------------------------------
[2011-01-05 23:01:09] jthijssen at noxlogic dot nl

Description:
------------
I'd like to see an getRegex() method in the regexIterator class that
will return the regular expression that is initialized during its
__construct(). 



Currently there is no way of retrieving that information except for
saving it yourself outside the object or extending regexiterator in
order to save the regex inside a custom constructor. 



It would be nice if the information about the object could actually be
retrieved natively since this data is already present, just not visible
to the outside world.



Attached is a patch with an implementation.  

Test script:
---------------
$array = array('cat', 'hat', 'sat');

$iterator = new ArrayIterator($array);

$regexIterator = new RegexIterator($iterator, '/.at/');

var_dump($regexIterator->getRegex());

Expected result:
----------------
string(5) "/.at/"

Actual result:
--------------
PHP Fatal error:  Call to undefined method ArrayIterator::getRegex() 


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=53659&edit=1

Reply via email to