[pmwiki-users] Deprecated preg_replace() eval feature in PHP 5.5
John Rankin
john.rankin at affinity.co.nz
Tue Sep 24 16:30:13 CDT 2013
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. But the Markup_e() function should not change a lot in
> the future, so I'll give an example:
>
> if until now a recipe used:
>
> Markup('id', 'direcives', '/p(a)tte(rn)/e', "ReplFunc('$1', '$2')");
>
> now it can alternatively use:
>
> Markup_e('id', 'direcives', '/p(a)tte(rn)/', "ReplFunc(\$m[1],
> \$m[2])");
>
> so the changes are:
> Markup_e() instead of Markup()
> the pattern without the "e" modifier after the last /
> the replacement with $m[0], $m[1], $m[2], $m[3] instead of '$0', '$1'
> etc.
> (this last one is not automatic, we should be careful there)
>
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? TIA
JR
--
John Rankin
Affinity Limited
T 64 4 495 3737
M 64 21 726 546
More information about the pmwiki-users
mailing list