[pmwiki-users] update to PHP 8 (video5)

Petko Yotov 5ko at 5ko.fr
Sat Oct 29 00:43:37 PDT 2022


On 29/10/2022 08:16, jdd at dodin.org wrote:
> Le 28/10/2022 à 23:22, Petko Yotov a écrit :
> 
>> Calls to Markup() or Markup_e() are the case here. :-)
> 
> I got the impression that _e was the better option, that show how bad
> I am on this respect :-(

The point here ("the case here"), is that these functions add 
configurations to be used / called by PmWiki at some later point, not 
when the recipe script is processed by PHP but later, when PmWiki 
converts the wiki text into HTML. So the PHP interpreter may not find 
syntax errors in the recipe itself, but it may cause PHP errors when 
PmWiki calls them.

Markup_e() was acceptable between PHP 5.5 and 7.2, and it made it 
slightly easier to migrate old recipes from the pre-5.5 format with /e 
regular expressions, by using create_function().

That one, create_function(), become deprecated in PHP 7.2, before 7.2 we 
didn't know it would be.

At the same time Markup_e() was added in PmWiki 2.2.56 (more than 9 
years ago!), a new way was added to define rules without evaluation and 
without create_function().

Both ways were documented. Since we didn't know create_function() would 
be deprecated, some recipe maintainers chose the slightly easier way.

Including myself, for the large number of core markup rules, it felt 
easier to maintain. When PHP deprecated it, I switched for the other 
way.


>>> What I couldn't understand is how do pmwiki think the cookbook
>>> is too old, I don't see anything in it
>> 
>> Here is how it works:
> (...)
> 
> I guess this is not done manually, but with a script. May be the
> result of this script could be seen somewhere as debugging aid? (in
> the future).

Indeed, in the future (and in the present), the result that appears in 
your page should be seen as a debugging aid -- such markup rule has been 
disabled, please update your recipe that adds this markup rule.

It tells people to check the page Troubleshooting where in the first 
section they can see how to track the recipe and what to do when they 
find it, notably:

   Search the documentation and the cookbook for more
   recent versions, or contact the addon maintainer,
   or leave a message on the talk page. If that
   doesn't work, contact us at our issue tracking system.
   Developers can find documentation on how to update
   old addons at CustomMarkup and Functions.

If this is not clear enough, please let me know how we can improve it.


All this has been documented, ever since it became possible, and 
continuously kept up-to-date since then:

   https://www.pmwiki.org/wiki/PmWiki/CustomMarkup

Again, a recent PmWiki version will happily process your old custom 
markup rules with /e on PHP earlier than 5.5, and will happily use 
create_function() as instructed by your custom recipes on PHP earlier 
than 7.2. It will only disable your markup rules when the PHP version is 
incompatible.

Petko



More information about the pmwiki-users mailing list