mirror of
https://github.com/moodle/moodle.git
synced 2025-04-14 04:52:36 +02:00
MDL-36773 timezone inconsistency => some number support decimal other don\'t - Original patch author: Nathan Mares
This commit is contained in:
parent
f42c34a38a
commit
8158ce79f9
@ -1134,7 +1134,7 @@ function clean_param($param, $type) {
|
||||
|
||||
case PARAM_TIMEZONE: //can be int, float(with .5 or .0) or string seperated by '/' and can have '-_'
|
||||
$param = fix_utf8($param);
|
||||
$timezonepattern = '/^(([+-]?(0?[0-9](\.[5|0])?|1[0-3]|1[0-2]\.5))|(99)|[[:alnum:]]+(\/?[[:alpha:]_-])+)$/';
|
||||
$timezonepattern = '/^(([+-]?(0?[0-9](\.[5|0])?|1[0-3](\.0)?|1[0-2]\.5))|(99)|[[:alnum:]]+(\/?[[:alpha:]_-])+)$/';
|
||||
if (preg_match($timezonepattern, $param)) {
|
||||
return $param;
|
||||
} else {
|
||||
|
@ -943,9 +943,23 @@ class moodlelib_testcase extends advanced_testcase {
|
||||
'0' => '0',
|
||||
'0.0' => '0.0',
|
||||
'0.5' => '0.5',
|
||||
'9.0' => '9.0',
|
||||
'-9.0' => '-9.0',
|
||||
'+9.0' => '+9.0',
|
||||
'9.5' => '9.5',
|
||||
'-9.5' => '-9.5',
|
||||
'+9.5' => '+9.5',
|
||||
'12.0' => '12.0',
|
||||
'-12.0' => '-12.0',
|
||||
'+12.0' => '+12.0',
|
||||
'12.5' => '12.5',
|
||||
'-12.5' => '-12.5',
|
||||
'+12.5' => '+12.5',
|
||||
'13.0' => '13.0',
|
||||
'-13.0' => '-13.0',
|
||||
'+13.0' => '+13.0',
|
||||
'13.5' => '',
|
||||
'+13.5' => '',
|
||||
'-13.5' => '',
|
||||
'0.2' => '');
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user