mirror of
https://github.com/moodle/moodle.git
synced 2025-04-22 00:42:54 +02:00
MDL-78544 forms: fix string to number comparison bug in duration element
Prior to PHP 8, 0 == "", but now no more. We should use empty instead. See: https://www.php.net/manual/en/migration80.incompatible.php
This commit is contained in:
parent
1b1a15a308
commit
60b086635c
@ -157,7 +157,7 @@ class MoodleQuickForm_duration extends MoodleQuickForm_group {
|
||||
* @return array associative array ($number => $unit)
|
||||
*/
|
||||
public function seconds_to_unit($seconds) {
|
||||
if ($seconds == 0) {
|
||||
if (empty($seconds)) {
|
||||
return [0, $this->_options['defaultunit']];
|
||||
}
|
||||
foreach ($this->get_units_used() as $unit => $notused) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user