-
Bug
-
Resolution: Fixed
-
Minor
-
4.3.6
In setup.php, serialize_precision is set to 17 to enforce consistency across environments that have changed this PHP setting from the default value...
https://github.com/moodle/moodle/blob/ad7fc69c25185b7c6e2fe4707d121aee71b8277f/lib/setup.php#L259
A new default value was introduced with PHP 7.1 however, we should change setup.php to reflect the new default value as it will cause json_encode() to incorrectly serialize float values between 0 and 1.
This affects Safe Exam Browser integration when using a quiz set to use an uploaded .seb config file via the "Upload my own config" option, SEB will present "The Safe Exam Browser keys could not be validated" when a student attempts to enter a quiz after downloading the SEB config.
During the process of deriving the config key hash, Moodle converts the property_list to a json string using json_encode(). If some of the properties have floating point values like 0.1 these are being converted to 0.10000000000000001 (hence a difference in the json string causing a different hash). This behaviour seems to be caused by Moodle setting serialize_precision to 17 in setup.php. The default value in PHP since 7.1 is -1 which uses a "an enhanced algorithm for rounding such numbers". See this bug... https://bugs.php.net/bug.php?id=72567
I found that when creating a SEB config file using a laptop, the following properties are added. For clarity I am only able to use SEB in a Windows 10 VM running on an Ubuntu linux laptop...
<key>batteryChargeThresholdCritical</key>
|
<real>0.1</real> |
<key>batteryChargeThresholdLow</key>
|
<real>0.2</real> |
Steps to reproduce this issue with Safe Exam Browser:
Using a Windows laptop, create a configuration file using SEB Configuration Tool...
- Enter the absolute URL for your quiz in General > Start URL
- Tick Exam > Use Browser Exam Key and Configuration Key
- Click Save Settings As from the file menu, create a new settings file.
- Verify the settings file contains properties with floating point numbers, like the ones mentioned above.
On Moodle as a teacher in a normal web browser...
- Create a new quiz activity.
- In General settings add a name.
- In Safe Exam Browser settings select "Yes - Upload my own config" from the "Require the use of Safe Exam Browser" dropdown list.
- Upload your settings file created above.
- Do not enter a browser key.
- Click Save and display.
As a student in a normal web browser...
- Browse to quiz activity.
- Click download configuration and double click the downloaded .seb file.
- SEB will launch.
- Log into Moodle
- Observe an error from Moodle.
- will help resolve
-
MDL-81334 Safe Exam Browser - key calculation algorithm error
-
- Open
-