[pmwiki-users] Recipes you use/need to be updated for PHP 5.5

Petko Yotov 5ko at 5ko.fr
Sat Jan 4 16:46:17 CST 2014

John Rankin writes:
> >> >   http://www.pmwiki.org/wiki/PmWiki/CustomMarkup#php55
> By my reading of the link above, all calls to Markup with a /e modifier
> will stop working under 2.2.56, yes?

Not at all - every time I write about this I repeat that the existing ways  
will NOT stop working. We ADDED a new way to define markup rules, the old  
one stays.

Under PHP 5.5, the old way will trigger a warning for a deprecated usage.  
That's why we added a new way for those who need it.

> Given the size of the task, I was planning to fix and test all the calls
> to preg_replace with a /e first (which won't require a pmwiki upgrade),
> then work on the Markup calls (which will). So it looks as if it would be
> useful to make a temporary copy of the PCCF() function in my cookbook/.

You can test if (function_exists('PCCF')) {...} else {...}
On the linked page I wrote a section wich tests if 'Markup_e' exists.

> In a lot of cases, I'm going to need the 'use' keyword to pass parameters
> to the callback function.

This will not work for PHP versions 5.2 and older IIRC, and you cannot  
declare inline (native) lambda functions (closires) before PHP 5.3. That's  
why in MarkupToHTML() I export a global array with the $pagename local  
variable and extract() it in the callback functions. If there is a better  
way, that is compatible with new and old PHP versions, I'll gladly review it  
and use it.


More information about the pmwiki-users mailing list