[pmwiki-devel] bug(?) report: preg_replace() problem

Petko Yotov 5ko at 5ko.fr
Fri Mar 27 07:32:58 CDT 2009


On Thursday 26 March 2009 17:31:02 Peter Bowers wrote:
>    preg_replace('/(a)/e', 'strtoupper($1)', 'asdfasdfasdfasdf');
>
> I'm running into a situation where it is returning AsdfAsdfasdfasdf
> (without replacing all occurrences).

I have experienced this when some other pattern has already processed and 
modified (or skipped) some of the occurrences. In PmWiki it might happen if 
the "when" parameter for Markup() is not correctly/optimally set.


> (As you can see I left a non-ptv pagelist at the top just for demonstration
> purposes.)  The end result is that any (:markup:) blocks after the FIRST
> pagelist which contains a PTV reference remain un-processed.
>
> It's easier to see than to describe:

> http://pmwiki.org/wiki/Test/PageListA

Right, there is a problem with more than two (:markup:)[=code=] although it 
doesn't seem to happen on other places like BasicEditing where it appears 
more than twice. We'll have to investigate further to find out why and how to 
fix it, but I suspect something messes with the $KPV array.

Otherwise, using (:markup:)...(:markupend:) seems to work fine with more than 
two pagelists.

Thanks,
Petko



More information about the pmwiki-devel mailing list