[pmwiki-users] preg_replace, how to circumwent?

John Rankin john.rankin at affinity.co.nz
Tue Apr 22 15:16:53 CDT 2014


I'll update the recipe! Thanks for spotting this one, which I missed. In
other places, I have been changing these to use anonymous functions.

JR

> Peter K.H. Gragert writes:
>> In wikilog.php online 482 one finds:
>>
>> $firstpara = preg_replace("/\\[\\=(.*?)\\=\\]/se",
>>       "Keep(PSS('$1'))",$firstpara);
>> And the /e  gives this error message
>>
>> Deprecated: preg_replace(): The /e modifier is deprecated, use
>> preg_replace_callback instead in
>> D:\xampp\htdocs\Atolls\cookbook\wikilog.php
>> on line 482
>>
>> What could be a general solution to this type of PHP problem
>
> In this case, use something like:
>
>   $firstpara = PPRE("/\\[\\=(.*?)\\=\\]/s", 'Keep($m[1])', $firstpara);
>
> For the general case see http://www.pmwiki.org/wiki/PmWiki/Functions#PPRE
> (also applied here).
>
> Petko
>
>
> _______________________________________________
> pmwiki-users mailing list
> pmwiki-users at pmichaud.com
> http://www.pmichaud.com/mailman/listinfo/pmwiki-users
>


-- 
John Rankin




More information about the pmwiki-users mailing list