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

Simon nzskiwi at gmail.com
Fri Sep 20 22:54:52 CDT 2013

Compliments to you Petko, and PM for this work and progress.
This is a major effort, well done.


On 21 September 2013 10:59, Petko Yotov <5ko at 5ko.fr> wrote:

> I have committed to the Subversion repository the latest code with the new
> formats. There are many small changes on many lines so a diff is hardly
> usable.
> 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)
> Note that the old interface with Markup() will not be removed so there is
> no urgency to migrate the recipes, except for hostings with PHP 5.5.
> If anyone would like to help, please get the latest code either via
> Subversion, or by downloading the file pmwiki-latest-svn.zip linked from
> this page: http://www.pmwiki.org/wiki/**PmWiki/Subversion<http://www.pmwiki.org/wiki/PmWiki/Subversion>.
> (maybe don't install it yet on production wikis, and always have backups
> of your last working version :-)
> This development pre-release should be tested and should work like 2.2.55
> even over older installations, and in all versions of PHP > 4.1, with and
> without UTF-8 enabled, etc. - should be as good as the stable.
> Additionally, it should also work in PHP 5.5 without too many warnings
> about the deprecated feature (when we're done, there shouldn't be any
> warnings).
> There may be some bugs, for example if some chunk of text is missing, a
> variable scope may have been forgotten: just show us how to reproduce the
> bug, for example on the pmwiki.org Test group, and we'll fix it.
> If you notice a problem or have questions or ideas for improvements,
> please tell us.
> Petko
> Petko Yotov writes:
>> Hello. Patrick and I have started addressing the issue of a deprecated
>> function in future versions of PHP.
>> Partick found the time to look into the problem and suggested a solution
>> which I couldn't see myself in the last 3-4 months. I have worked on it
>> yesterday and today and the migration appears possible, without breaking
>> existing recipes or dropping support for PHP 4!!
>> At this moment, most of the core Markup() rules are rewritten to the new
>> format, and we still need to decide how to deal with different replacement
>> patterns like $ROSPatterns or $MakePageNamePatterns.
>> The next PmWiki version should be mostly done and compatible with PHP 5.5.
>> Our plan is to first remove the deprecated feature from the core program,
>> and then advise recipe authors to use the new Markup definition format
>> (which will be relatively easy).
>> In a recipe, the old format will continue to work with the new PmWiki
>> versions so an existing wiki with local customisation shouldn't break after
>> a PmWiki upgrade. But if your hosting provider forces you to use PHP 5.5 or
>> just disables the deprecated feature, you may have to upgrade both PmWiki
>> and your recipes.
> ______________________________**_________________
> pmwiki-users mailing list
> pmwiki-users at pmichaud.com
> http://www.pmichaud.com/**mailman/listinfo/pmwiki-users<http://www.pmichaud.com/mailman/listinfo/pmwiki-users>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20130921/b65163eb/attachment-0001.html>

More information about the pmwiki-users mailing list