[pmwiki-users] preg_replace-Warning in pmwiki.php

Knut Alboldt pmwiki at alboldt.de
Sun Jan 25 13:20:18 CST 2009

Hi !

when I use the pagelist-markup I sometime get a warning like

Warning: preg_replace() 
[/docs/it/php/manual.5.x.y/function.preg-replace.html]: Compilation 
failed: missing ) at offset 76 in 
D:\HTDOCS\pmwiki.2.2.0.beta65\pmwiki.php on line 730

which "detroys" the output of the list of pages.

The reason is a erroneous entry of a pagetextvar, e.g.:

(:Beschreibung: :geplante Videos für die Videogalerie auf wzonline.de::

because in my markups, the last :: will be processed before and so it 
will give a wrong value for the pagetextvar.
It's not a problem of the pagetextlist-markup but in my own data - but 
very difficult to find without any more information, why the compilation 

So it would be very helpful, if the pmwiki.php would display some more 
information (here: the value of $m[2] after line 730, if a warning has 
been generated during the execution of the preg_replace()-function, so 
one could identify the contents of the tested var (and so the erroneous 
page more easily). I try to get it solved using the $php_errormsg in the 
following way:

  foreach($match as $m) {
    $php_errormsg = '';       # <<<<<<<<<<<<<<
    $t = preg_replace("/\\{\\$:{$m[2]}\\}/", '', $m[3]);
    if ($php_errormsg !=="") # <<<<<<<<<<<<<<
      { echo "TRACE:".$php_errormsg." m[2]=".$m[2]."<br />"; } # <<<<<<<
    $pc["=p_{$m[2]}"] = Qualify($pagename, $t);

maybe the changes could find a way to the pmwiki.php.



More information about the pmwiki-users mailing list