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

Chuck Goldstein cgpmw13 at codingmaniac.com
Fri Dec 1 22:26:12 CST 2017


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

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pmwiki-cg.diff
URL: <http://www.pmichaud.com/pipermail/pmwiki-devel/attachments/20171201/07018f67/attachment.ksh>


More information about the pmwiki-devel mailing list