[pmwiki-users] preg_replace issue for php 5.6
jeanpierre.chretien at free.fr
Wed Aug 5 08:03:48 CDT 2015
Petko Yotov <5ko <at> 5ko.fr> writes:
> The same warning may appear with some of the $*Patterns arrays, like
> $MakePageNamePatterns or $ROEPatterns if they are not updated for PHP
> 5.5. Try deactivating lines from (farm)config.php until you find the one
> that produces the warning.
> See how the core $MakePageNamePatterns creates a callback function to
> make a letter uppercase (pmwiki.php, line 729). Or we can help you
> rewrite the patterns.
> Also, your shell search may skip some recipes: a regular expression with
> evaluation '/e' may have other modifiers, it may look like
> that is, any letters among [x, s, i, u] before "e" and it is still
> evaluated so will cause a warning. Or the modifiers can be a variable
> like /$mods which is expanded by PHP.
> Incidently, the slash is not always present, a regular expression may
> use other delimiters like "!". That's why I mostly rely on progressively
> deactivating recipes or local configuration until I find the problem.
Thanks for your answer.
I think I found the culprit (or one of the culprits, the procedure is not
over yet) : here is what I see in convert-html.php
L31 '#\s*(<(ul|ol)\s*>\s*<li.*</\2>)\n?#ise' =>
L38 '#\s*<h(\d)\s*>(.*?)</h\1>\n*#ise' => "\"\n\n\".str_repeat('!','$1').'
L42 '#<span\b\s*([^>]*)>(.*?)</span>#ise' =>
'"%".ConvertHtmlSpan(stripslashes("$1"))."% $2 %%"',
L59 '#<a\s[^>]*\bname=([\'"])([^\'"]*?)\1[^>]*>(.*?)</a>#ise' =>
L60 '#<a\s+([^>]*)>(.*?)</a>#ise' => 'ConvertHtmlLink(stripslashes("$1"),
L69 '#<select\b([^>]*)>(.*?)</select>#ise' =>
which cumulate both a complex modifier "ise" and a delimiter different from
the usual "/".
This substitutions takes place in a single SDVA( $ROEPatterns, array( function.
I'm not fluent in php, so what would be the modifications needed to solve
this ? Is it enough to replace "$x" by "$md[x]" ?
I have a further problem: I make the error messages
Deprecated: preg_replace(): The /e modifier is deprecated, use
preg_replace_callback instead in /home/cjpdic/www/testJdJ/wiki/pmwiki.php on
appear by decommenting line
#if ($action=='edit') include_once("cookbook/convert-html.php");
But the messages still appear after I re-comment the line, whatever I do on
the browser side (ask for a fresh reload of the page with Shift-reload, wipe
out the cache). Seems that restarting the computer is the only way to
recover a correct behavior.
I have a further question: I made corrections in the bonny skin code and in
the pmform.php code to be php5.5 compatible, following what "action=ruleset"
suggested to me: do you update these non-maintained modules yourself, do
you ask to their developers to do so, or is it up to the user to make the
updates (in the last case, it would be good to add lines in the module
documentation or discussion to provide needed code changes).
More information about the pmwiki-users