[pmwiki-users] (:pagelist count=10..:) after update to php8
Petko Yotov
5ko at 5ko.fr
Sat Aug 20 01:13:28 PDT 2022
На 20/08/2022 09:24, Armin Bühler написа:
> After OS update from ubuntu 20 to 22.04 which also updates php7.x to
> php8.1.2 I've get an empty page and log file shows:
>
> [Sat Aug 20 08:52:01.815450 2022] [proxy_fcgi:error] [pid 335456]
> [client 192.168.1.248:52922] AH01071: Got error 'PHP message: PHP Fatal
> error: Uncaught TypeError: Unsupported operand types: string + int in
> /data/www/pmwiki/scripts/pagelist.php:664
...
>
> The pmwiki directive which causes the error message is:
> (:pagelist group=FAQ count=16..:)
> The error started after the php Update. I think the behavior of the
> return values from explode() has changed.
Thanks for reporting this, fixed for 2.3.10, to be released in the next
few days.
You can get a partial export with only the files changed since
pmwiki-2.3.9 from the page ChangeLog:
https://www.pmwiki.org/wiki/PmWiki/ChangeLog
If you test it, please report if it works, or we missed something else.
> I solved this by adding 2 lines which checks the returned values of
> explode() at line 663 in scripts/pagelist.php:
> ...
> list($r0, $r1) = explode('..', $range);
> if (!isset($r0) || $r0 == "") $r0 = -1;
> if (!isset($r1) || $r1 == "") $r1 = -1;
Actually, when a value was empty or null, for arithmetic operations
previous PHP versions considered it 0, not -1. (Now in the same cases
PHP raises an error.)
The simplest fix may be to do $r0 = intval($r0); and 2 similar
occurrences.
Petko
More information about the pmwiki-users
mailing list