[Pmwiki-users] Bug in [[include:...]] markup translation

Jonathan Scott Duff duff
Wed Jul 30 21:57:46 CDT 2003


On Wed, Jul 30, 2003 at 10:51:41PM -0500, Jonathan Scott Duff wrote:
> On Thu, Jul 31, 2003 at 03:12:29PM +1200, John Rankin wrote:
> > If I write:
> > 
> >   Here is $123 million.
> > 
> > on SomePage. Then on another page write:
> > 
> >   [[include:SomePage]]
> > 
> > it comes out as
> > 
> >   Here is 3 million.
> > 
> > It appears to be the $ sign that is causing the problem. Writing
> > 
> >   Here is 123 million.
> > 
> > works as expected.
> > 
> > Try including http://www.pmichaud.com/wiki/Main/WikiSandbox and you will see what I mean.
> > 
> > Anyone have any ideas?
> 
> Yep.  I quickly glanced at the code and noticed that Pm is using
> preg_replace() to obtain the include effect.  preg_replace() will do
> $N substitutions on the replacement text where N is from 0 to 99. Thus
> it replaces $12 with the twelfth (emtpy) parenthesized thing in the
> pattern.

A possible solution from looking at php.net might be to change line
804 from this: 

    $Text = preg_replace("/\\[\\[include:(.*?)\\]\\]/",$incltext,$Text,1);
 
to this:

    $Text = preg_replace("/\\[\\[include:(.*?)\\]\\]/",addcslashes($incltext,'\\$'),$Text,1);

-Scott
-- 
Jonathan Scott Duff
duff at cbi.tamucc.edu



More information about the pmwiki-users mailing list