[pmwiki-devel] bug(?) report: preg_replace() problem
Peter Bowers
pbowers at pobox.com
Thu Mar 26 11:31:02 CDT 2009
Has anybody ever heard of something that would cause preg_replace() to abort
when it has only replaced some (not all) of the occurrences?
For instance... (this is not the example that has problems - just an
illustration)
preg_replace('/(a)/e', 'strtoupper($1)', 'asdfasdfasdfasdf');
I'm running into a situation where it is returning AsdfAsdfasdfasdf (without
replacing all occurrences).
Obviously the example above does not replicate the problem. The function in
the replacement is actually in MarkupToHTML() in the rule for
MarkupMarkup(). I've replicated it on 3 hosts (including pmwiki.org).
It occurs when there is a (somewhat farfetched) edge condition -- I have a
page Test.ThrottlePage with several thousand lines consisting of a numeric
timestamp followed by a colon -- thus they are interpreted as PTVs:
12341234:
23452345:
34563456:
Then to reproduce the problem you must have 2 pagelists contained in
(:markup:) each of which reference pagevars:
===========(snip)============
(:markup:) [=
(:pagelist group=Test wrap=inline hello:)
=]
(:markup:) [=
(:pagelist group=Test wrap=inline $:Name=Page*:)
=]
(:markup:) [=
(:pagelist group=Test wrap=inline $:Author=*McQuilk*:)
=]
===========(snip)============
(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.qdk.org/pmwiki.php/Test/PageList
http://pmwiki.org/wiki/Test/PageListA
I haven't played around with ThrottlePage to see how big it has to be in
order to cross this threshold... Maybe it's far enough outside the norm
that it doesn't even merit being addressed, but I'll tell you it was a
*pain* tracking it down...
-Peter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.pmichaud.com/pipermail/pmwiki-devel/attachments/20090326/a8fedc8e/attachment.html
More information about the pmwiki-devel
mailing list