Error when consulting the Markbook from a student (v26)

Hi @sandra ,

I have a crash when I consult the Markbook from a student.
I’m using PHP 8.2. It’s probably a casting issue.

[Thu Mar 21 00:44:13.482472 2024] [php:notice] [pid 242407] [client]
Uncaught Exception: TypeError - round(): Argument #1 ($num) must be of type int|float, string given in
/var/www/gibbon.local/modules/Markbook/moduleFunctions.php on line 267,
referer: http://…/index.php?q=%2Fmodules%2FStudents%2Fstudent_view_details.php&gibbonPersonID=0000000005&search=suzuki&sort=surname%2CpreferredName&allStudents=

// Calculate & get the cumulative average
$cumulativeMark = round($markbook->getCumulativeAverage($gibbonPersonID, $gibbonSchoolYearTermID));


Gibbon : v26.0.00 ca-fr, PHP v8.2.10, MySQL v8.0.36, Ubuntu 23.10.1

Ah yes, that does look like an 8.2 related type-checking error. Can you try the following fix, and if that works I’ll add it to v27.

$cumulativeMark = round(floatval($markbook->getCumulativeAverage($gibbonPersonID, $gibbonSchoolYearTermID)));

Let me know if you spot any more 8.2 related errors, we’ve tried to catch them all in the previous full system test, but there’s a lot of surface area in the codebase and hard to catch each combination of possible settings.

Hi @sandra,

I applied the change and it fixed the crash.
I’ll continue my tests and let you know if there are any other problems with PHP 8.2.



1 Like