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:             Assigned
+Status:             Closed
 Type:               Feature/Change Request
 Package:            SPL related
 Operating System:   All
 PHP Version:        5.3SVN-2011-01-05 (SVN)
 Assigned To:        aharvey
 Block user comment: N
 Private report:     N

 New Comment:

This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

Committed on trunk: the change to the _spl_dual_it_object struct will

prevent this going into 5.3. Thanks for the patch, Joshua!


Previous Comments:
------------------------------------------------------------------------
[2011-01-06 03:32:04] ahar...@php.net

Automatic comment from SVN on behalf of aharvey
Revision: http://svn.php.net/viewvc/?view=revision&revision=307147
Log: Implement request #53659 (Implementing RegexIterator::getRegex()
method). Patch
by Joshua Thijssen.

------------------------------------------------------------------------
[2011-01-06 02:47:11] ahar...@php.net

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

------------------------------------------------------------------------
[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