[pmwiki-users] preg_replace (RFC)

Peter Bowers pbowers at pobox.com
Fri Dec 5 15:22:50 CST 2014


On Thu, Dec 4, 2014 at 9:55 AM, Hans Bracker <design at softflow.co.uk> wrote:

> Could  PmWiki  be more specific to identify in which function call and
> script offending regular expressions reside?
>

What if pmwiki was distributed with 2 copies of pmwiki.php -- one the
standard production version and the other pmwiki-debug.php.  In the case of
a need for troubleshooting an admin would swap out the pmwiki.php with the
pmwiki-debug.php (simply renaming appropriately) and then re-load the
page.  The pmwiki-debug.php version could do various things to help debug:

* The Markup() and Markup_e() functions could have an additional step of
creating an array indexed by regex/replace strings and holding a
"Scriptname.php: lineno" string.  Then when Petko's error is triggered it
could include the script name and line #
* The "Debugging pmwiki rules" section of
http://www.pmwiki.org/wiki/Cookbook/DebuggingForCookbookAuthors#rules could
be made available and turned on/off via some $Enable variable

Come to think of it, both of those changes could be turned on/off by
$EnableDebugMarkup and $EnableDebugRules variables rather than swapping
different version of pmwiki.php (oh, for the presence of an #ifdef
preprocessor in PHP!)...

The presence of these 2 changes would be of GREAT value in
troubleshooting.  The first greatly enhances the error message and the
second allows you to see in great detail exactly which rule is causing the
undesired behavior.

-Peter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20141205/4d3b4a98/attachment.html>


More information about the pmwiki-users mailing list