Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'MDL-36773-master' of git://github.com/mouneyrac/moodle
  • Loading branch information
danpoltawski committed Dec 11, 2012
2 parents 46c02a6 + 8158ce7 commit b3b4fad
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/moodlelib.php
Expand Up @@ -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 {
Expand Down
14 changes: 14 additions & 0 deletions lib/tests/moodlelib_test.php
Expand Up @@ -943,9 +943,23 @@ function test_clean_param_timezone() {
'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' => '');

Expand Down

0 comments on commit b3b4fad

Please sign in to comment.