mirror of
https://github.com/php/php-src.git
synced 2024-11-30 21:35:36 +08:00
MFH
This commit is contained in:
parent
2e3faf9cd2
commit
045dd11483
@ -196,7 +196,7 @@ static int tz_search(char *timezone, int left, int right, const timelib_tzdb *tz
|
||||
{
|
||||
int mid, cmp;
|
||||
|
||||
if (left >= right) {
|
||||
if (left > right) {
|
||||
return -1; /* not found */
|
||||
}
|
||||
|
||||
@ -217,7 +217,7 @@ static int seek_to_tz_position(const unsigned char **tzf, char *timezone, const
|
||||
{
|
||||
int pos;
|
||||
|
||||
pos = tz_search(timezone, 0, tzdb->index_size, tzdb);
|
||||
pos = tz_search(timezone, 0, tzdb->index_size - 1, tzdb);
|
||||
|
||||
if (pos == -1) {
|
||||
return 0;
|
||||
|
26
ext/date/tests/timezones.phpt
Normal file
26
ext/date/tests/timezones.phpt
Normal file
@ -0,0 +1,26 @@
|
||||
--TEST--
|
||||
setting bogus timezones
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
//bogus
|
||||
var_dump(date_default_timezone_set('AAA'));
|
||||
var_dump(date_default_timezone_set('ZZZ'));
|
||||
|
||||
|
||||
//now the first and the last one
|
||||
var_dump(date_default_timezone_set("Africa/Abidjan"));
|
||||
var_dump(date_default_timezone_set("Zulu"));
|
||||
|
||||
echo "done\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Notice: date_default_timezone_set(): Timezone ID 'AAA' is invalid in %stimezones.php on line 4
|
||||
bool(false)
|
||||
|
||||
Notice: date_default_timezone_set(): Timezone ID 'ZZZ' is invalid in %stimezones.php on line 5
|
||||
bool(false)
|
||||
bool(true)
|
||||
bool(true)
|
||||
done
|
Loading…
Reference in New Issue
Block a user