-
Bug
-
Resolution: Fixed
-
Critical
-
3.11.5, 4.0
-
MOODLE_311_STABLE, MOODLE_400_STABLE
-
MOODLE_311_STABLE
-
Hi there,
I was testing Moodle on PHP8.0 and I've encountered a bug. Our language uses a decimal comma, and this can be by PHP interpreted as string. In PHP 8, as stated here, function round() no longer auto-typecast objects, and this can result in fatal error. One confirmed place is in the "Grade item" page (/grade/edit/tree/item.php). If a number with decimal comma is submitted, user gets following error:
round(): Argument #1 ($num) must be of type int|float, string given
|
line 1599 of /lib/gradelib.php: TypeError thrown
|
line 1599 of /lib/gradelib.php: call to round()
|
line 1612 of /lib/gradelib.php: call to grade_floatval()
|
line 469 of /grade/edit/tree/item_form.php: call to grade_floats_different()
|
line 653 of /lib/formslib.php: call to edit_item_form->validation()
|
line 589 of /lib/formslib.php: call to moodleform->validate_defined_fields()
|
line 699 of /lib/formslib.php: call to moodleform->is_validated()
|
line 112 of /grade/edit/tree/item.php: call to moodleform->get_data()
|
I would like to ask; has the compatibility of decimal commas been verified in PHP 8 in any way?
For now, we'll just add typecasting in the code; but it would be good to fix this.
Thank you for your response.
Jarý Miroslav
Moodle FEE CTU in Prague
- caused a regression
-
MDL-74516 Create a quiz with passing grade completion causing error
- Closed
- Testing discovered
-
MDL-73944 Random behat failures with some H5P activity tests
- Open
-
MDL-73946 Decide if grades export should use localised decimal/thousands separators
- Open
-
MDL-73936 Ajax grader doesn't work for non-english decimal separators
- Closed
-
MDL-73941 Review reportbuilder and ensure that all floats are using current lang decsep
- Closed
-
MDL-73968 Consider using a custom strings manager for PHPUnit and Behat runs
- Open
-
MDL-73967 Consider deprecating decsep/thousandssep and move to localecldr
- Open
-
MDL-73994 Review if all the float form element transformations are correct
- Open