[pmwiki-users] (:pagelist count=10..:) after update to php8

Armin Bühler armin at pan.ddnss.de
Sat Aug 20 00:24:28 PDT 2022


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\nStack trace:\n#0
/data/www/pmwiki/scripts/pagelist.php(748): CalcRange()\n#1
/data/www/pmwiki/scripts/pagelist.php(694): FPLTemplateSliceList()\n#2
/data/www/pmwiki/scripts/pagelist.php(238): FPLTemplate()\n#3
/data/www/pmwiki/scripts/pagelist.php(103): FmtPageList()\n#4 [internal
function]: MarkupPageList()\n#5 /data/www/pmwiki/pmwiki.php(2161):
preg_replace_callback()\n#6 /data/www/pmwiki/pmwiki.php(2211):
MarkupToHTML()\n#7 /data/www/pmwiki/pmwiki.php(440): HandleBrowse()\n#8
/data/www/pmwiki/pmwiki.php(427): HandleDispatch()\n#9
/data/www/pmwiki/index.php(1): include('...')\n#10 {main}\n  thrown in
/data/www/pmwiki/scripts/pagelist.php on line 664'
192.168.1.248 - - [20/Aug/2022:08:52:01 +0200] "GET
/pmwiki/index.php?n=FAQ.FAQ HTTP/1.1" 500 217 "-" "curl/7.81.0"

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.
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; 
...

Cheers,
Armin



More information about the pmwiki-users mailing list