# What is the use of the $replacement property in the RegexIterator class.

- Thread: https://externals.io/message/48225
- Original archive: https://news-web.php.net/php.internals/48225
- Started by Richard Quadling on 2010-05-05T16:25:43+00:00
- Messages: 5
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #48225 — Richard Quadling — 2010-05-05T16:25:43+00:00

URL: https://externals.io/message/48225#48225

Hi.

I'm in the process of getting the PHPDoc classes showing the correct
inherited properties and methods (public/protected but not private).

I picked RecursiveRegexIterator (it has the largest number of
xi:includes in the documentation) as a test.

Using php --rc I see that the inheritance chain is
RecursiveRegexIterator, RegexIterator, FilterIterator and
IteratorIterator.

The property $replacement is part of RegexIterator.

I can see no documentation for this in phpdoc, nor in the Doxygen at
http://www.php.net/~helly/php/ext/spl/


In all the examples I've made so far, `var_dump()`-ing the RegexIterator
results in a ["replacement"]=>NULL

Assigning a value to $replacement seems to have no bearing on the output.

Regards,

Richard.


-- 
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

---

## #48226 — Jared Williams — 2010-05-06T01:09:43+00:00

URL: https://externals.io/message/48225#48226 · In reply to: #48225

> -----Original Message-----
> From: Richard Quadling [mailto:rquadling@googlemail.com] 
> Sent: 05 May 2010 17:26
> To: PHP internals; PHP Documentation List
> Subject: [PHP-DEV] What is the use of the $replacement 
> property in the RegexIterator class.
> 
> Hi.
> 
> I'm in the process of getting the PHPDoc classes showing the 
> correct inherited properties and methods (public/protected 
> but not private).
> 
> I picked RecursiveRegexIterator (it has the largest number of 
> xi:includes in the documentation) as a test.
> 
> Using php --rc I see that the inheritance chain is 
> RecursiveRegexIterator, RegexIterator, FilterIterator and 
> IteratorIterator.
> 
> The property $replacement is part of RegexIterator.
> 
> I can see no documentation for this in phpdoc, nor in the 
> Doxygen at http://www.php.net/~helly/php/ext/spl/
> 
> 
> In all the examples I've made so far, `var_dump()`-ing the 
> RegexIterator results in a ["replacement"]=>NULL
> 
> Assigning a value to $replacement seems to have no bearing on 
> the output.
> 
> Regards,
> 
> Richard.
> 
> 

Does seem odd public property. Guessing it's a bug.

http://www.php.net/~helly/classbrowser/?class=RecursiveRegexIterator

Jared

---

## #48227 — Peter Cowburn — 2010-05-06T07:55:34+00:00

URL: https://externals.io/message/48225#48227 · In reply to: #48225

> Hi.
>
> I'm in the process of getting the PHPDoc classes showing the correct
> inherited properties and methods (public/protected but not private).
>
> I picked RecursiveRegexIterator (it has the largest number of
> xi:includes in the documentation) as a test.
>
> Using php --rc I see that the inheritance chain is
> RecursiveRegexIterator, RegexIterator, FilterIterator and
> IteratorIterator.
>
> The property $replacement is part of RegexIterator.
>
> I can see no documentation for this in phpdoc, nor in the Doxygen at
> http://www.php.net/~helly/php/ext/spl/
>
>
> In all the examples I've made so far, `var_dump()`-ing the RegexIterator
> results in a ["replacement"]=>NULL
>
> Assigning a value to $replacement seems to have no bearing on the output.

I believe the intention was to give that property a value which could
be used with RegexIterator::REPLACE mode but that particular mode has
not yet been fully implemented.  There is a related bug (
http://bugs.php.net/50579 ) that has not been assigned; I can't say
what the plan is for if/when the replacement mode will get some
attention. See also: the PHP implementation of RegexIterator (
http://svn.php.net/viewvc/php/php-src/trunk/ext/spl/internal/regexiterator.inc?view=markup
).

>
> Regards,
>
> Richard.
>
>
> --
> -----
> Richard Quadling
> "Standing on the shoulders of some very clever giants!"
> EE : http://www.experts-exchange.com/M_248814.html
> EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
> Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
> ZOPA : http://uk.zopa.com/member/RQuadling

---

## #48257 — Richard Quadling — 2010-05-11T12:33:46+00:00

URL: https://externals.io/message/48225#48257 · In reply to: #48227

> 
> > […]
>
> I believe the intention was to give that property a value which could
> be used with RegexIterator::REPLACE mode but that particular mode has
> not yet been fully implemented.  There is a related bug (
> http://bugs.php.net/50579 ) that has not been assigned; I can't say
> what the plan is for if/when the replacement mode will get some
> attention. See also: the PHP implementation of RegexIterator (
> http://svn.php.net/viewvc/php/php-src/trunk/ext/spl/internal/regexiterator.inc?view=markup
> ).
>
> > […]
>

So, this should be documented as what?

As we don't document the future, I think this property should be
omitted from the RegexIterator documentation until such time the
property is useful.

Basically, leave it as is.

Yes?

-- 
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

---

## #48258 — Peter Cowburn — 2010-05-11T12:40:32+00:00

URL: https://externals.io/message/48225#48258 · In reply to: #48257

On 11 May 2010 13:33:46 UTC+1, Richard Quadling
<rquadling@googlemail.com> wrote:
> 
> > […]
>
> So, this should be documented as what?
>
> As we don't document the future, I think this property should be
> omitted from the RegexIterator documentation until such time the
> property is useful.
>
> Basically, leave it as is.

Sounds fine to me.

>
> Yes?
>
> --
> -----
> Richard Quadling
> "Standing on the shoulders of some very clever giants!"
> EE : http://www.experts-exchange.com/M_248814.html
> EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
> Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
> ZOPA : http://uk.zopa.com/member/RQuadling
