[pmwiki-users] Deprecated preg_replace() eval feature in PHP 5.5

Petko Yotov 5ko at 5ko.fr
Fri Sep 27 00:33:00 CDT 2013


John Rankin writes:
> On 21/09/13 10:59 AM, Petko Yotov wrote:
>>
>> A few new functions were added:
>>  PCCF() PmWiki Create Callback Function
>>  PPRE() PmWiki preg_replace eval
>>  PPRA() PmWiki preg_replace arrays
>>  Markup_e() like Markup() but with replacement evaluated in a Callback
>>
>> We'll document these functions once we're sure they work like we want them  
>> to work.
....
> If a recipe uses preg_replace with an e modifier directly in its code, is  
> there a pmwiki-recommended way to use the new pmwiki functions and/or  
> replace the preg_replace calls with suitable preg_replace_callback?

The helper functions above will make it easier but using these functions  
will not be required. A recipe needed to run with in PHP 5.5 could rewrite  
the snippets like the examples here:

  http://php.net/manual/en/function.preg-replace-callback.php

You need to be carefull with the scope of the internal variables used in the  
replacement (this also applies with our helper functions) and with the  
callback declaration, as some ways require PHP 5.3.

Petko




More information about the pmwiki-users mailing list