[pmwiki-devel] Some changes to pmwiki.php that help diagnose php7.2 problems

Petko Yotov 5ko at 5ko.fr
Mon Jul 9 10:31:34 PDT 2018


Sorry for the very late reaction.

Thanks for your contributions, excellent work!

For PmWiki 2.2.108 I have added a $PCCFOverrideFunction variable that 
allows an addon to replace PCCF() with a custom function.

ChuckG already wrote such an addon here:

   https://www.pmwiki.org/wiki/Cookbook/PccfToPcfOverride

For PmWiki 2.2.109 (already committed to Subversion) I have added the 
$EnableMarkupDiag and $tracelev variables suggested by Chuck that allow 
to backtrace all Markup() calls in ?action=ruleset, not only the 
deprecated ones.

Thanks,
Petko

On 02/12/2017 05:26, Chuck Goldstein wrote:
> My Web host, 1and1, is running PHP Version 7.2.0RC6. I've updated
> pmwiki.php to cause fewer "deprecated" warnings about Cookbook
> recipes, and to provide some diagnostic information. Please see the
> attached patch "pmwiki-cg.diff".
> 
> 
> The first hunk defines two new functions:
> 
> 1. PCF($args, $code) is a replacement for PHP's create_function(). It
> creates a lambda function. When enabled by setting $EnablePCF to a
> true value in a config file, it uses PHP eval() to create the
> function. If not enabled, it uses create_function().
> 
> 2. PCFWarn() is a utility function used by PCF and the modified PCCF.
> When enabled by setting $EnablePCFWarn to a true value in a config
> file, it adds an entry to the $MessagesFmt array describing the
> function which was called (Markup_e, PPRE, PCCF or PCF), the name of
> the file containing the call, the line number in the file and whether
> a function had to be created.
> 
> It also modifies PCCF to call PCF instead of create_function and to
> call PCFWarn if it gets the lambda from its cache array,
> $CallbackFunctions.
> 
> 
> The second hunk modifies the Markup and Markup_e functions so that, if
> enabled by setting $EnableMarkupDiag to a true value in a config file,
> the caller's file name, line number and pattern are saved in the
> markup table for every call, not just those using the deprecated "e"
> flag. This makes the ruleset and ruletable actions very instructive.
> 
> 
> To see the result of the first hunk, see the page footer at:
> 
> *
> http://p72b.codingmaniac.com/pmwikitestsvn01/apcu/index.php?n=ChuckG.GroupPageListsByNameMe
> 
> (all one line).
> 
> To see the result of the second hunk, see:
> 
> *
> http://p72b.codingmaniac.com/pmwikitestsvn01/apcu/index.php?n=ChuckG.ChuckG&action=ruletable&rtdiag=1&columns=cmd,pat,rep
> 
> 
> Chuck G



More information about the pmwiki-devel mailing list