[pmwiki-devel] PHP upgrade error

Simon nzskiwi at gmail.com
Fri Jun 18 01:12:17 PDT 2021


The problem turned out to be in a recipe I wrote.

My recipe nztopo.php had line
  $plabel   = 'label=(?:(?:\'[^\']+\')|(?:"[^"]+")|(?:[\w*-*+!?()]+))'; #
provide for single and double quoted strings, and unquoted string (no
spaces)
now changed to
  $plabel   = 'label=(?:(?:\'[^\']+\')|(?:"[^"]+")|(?:[*-*\w+!?()]+))'; #
provide for single and double quoted strings, and unquoted string (no
spaces)

thanks to Petko for telling me so clearly what to look for.

ngā mihi

Simon


On Thu, 17 Jun 2021 at 19:12, Petko Yotov <5ko at 5ko.fr> wrote:

> Oh, this may possibly be a core bug, I'd be very interested in tracking
> it.
>
> There is a regular expression containing minus in a character range like
> [a-z]. In these cases the minus sign means all characters after "a"
> (code point 97) and before "z" (code point 122) (like b, c,..., w, x,
> y).  If we need to match a literal dash, we place it at the start or at
> the end of the range like [-a-z].
>
> A range like [z-a] is invalid because there are no characters that are
> at the same time after "z" (code point higher than 122) and before "a"
> (code point lower than 97).
>
> Before PHP 7.3, such cases considered the minus to be a literal dash,
> not a range, i.e.  [z-a] only matched the characters "z", "-", "a" and
> they were silently processed, potentially unlike what the author
> intended.
>
> Since PHP 7.3, invalid character ranges raise the warning you saw.
>
> BTW [a-z] and [z-a] are easy to understand and fix, but I suspect the
> problem comes from something like [#%-!] or there may be an
> international character somewhere. If I have omitted to update the core,
> I'll do it, and if it is in a recipe, I can provide a fix or a
> workaround.
>
> At your convenience, you can start with an empty config.php and
> progressively add and test all your PmWiki configurations and test the
> wiki if at any point the warning appears, see PmWiki/Troubleshooting. If
> it does, let me know. After that, start adding the recipes one after
> another, and again test every time.
>
> Let me know of the results.
>
> Petko
>
> On 17/06/2021 08:27, Simon wrote:
> > My ISP has just upgraded PHP
> > to 7.4I thought I had everything up to date, but I see this error (and
> > not
> > much of a website
> > <https://ttc.org.nz/pmwiki/pmwiki.php/TTC/ClubNight>).
> > PHP Warning:  preg_replace_callback(): Compilation failed: invalid
> > range in
> > character class at offset 648 in
> > /home/ttcorgnz/public_html/pmwiki/pmwiki.php on line 1930
> >
> > I've commented out all recipes (in cookbook) with
> > preg_replace_callback.
> > It didn't fixed it.
> >
> > While I try to track it down I wondered if anyone has seen something
> > similar
> >
> > thanks
> >
> > Simon
> >
> > _______________________________________________
> > pmwiki-devel mailing list
> > pmwiki-devel at pmichaud.com
> > http://www.pmichaud.com/mailman/listinfo/pmwiki-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pmichaud.com/pipermail/pmwiki-devel/attachments/20210618/b916dcd7/attachment.html>


More information about the pmwiki-devel mailing list