Topic: Error with PHP 8.5
Hi Roel
An error message appeared with version 5.3.5 on PHP 8.5, at the top of the calendar: Warning: Cannot use bool as array in ..luxcal/common/retrieve.php on line 82 The fix (thanks to Claude) is:
Line 82 in retrieve.php:
php
while (list($ID,$sda,$eda,$checked,$rUntil) = $stH->fetch(PDO::FETCH_NUM)) {
The cause is the loop's exit condition, not a broken query. When the rows run out, fetch() returns false, and list() tries to destructure that false as an array. PHP 7 did it silently; PHP 8.5 warns. The loop then exits correctly — so it's harmless, but it fires once every time the function runs, and retrieve() is called several times per page. That's exactly the repetition you're seeing.
Replace line 82 with:
php
while (($rollRow = $stH->fetch(PDO::FETCH_NUM)) !== false) {
list($ID,$sda,$eda,$checked,$rUntil) = $rollRow;
Behaviour is identical — fetch, check it's a real row, then destructure. Note this adds a line, so the original while (...) { becomes two lines; everything inside the loop stays as it is.
Three follow-ups:
The same pattern is almost certainly behind the others. Your earlier log showed header.php lines 287/299/312 and eventform1.php line 30. Check whether those are also list(...) = ...fetch(...) in a while — same fix applies.
Report it to LuxSoft. This will affect every LuxCal install on PHP 8.5, and it's a two-line fix per occurrence — they'd likely want it in 5.3.6.
It seemed to work well.
Regards
Riaan
Claude is AI and can make mistakes. Please double-che