summaryrefslogtreecommitdiff
path: root/ext/date/tests
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2015-02-20 10:01:00 +0100
committerOndřej Surý <ondrej@sury.org>2015-02-20 10:01:00 +0100
commit347aa01617585e89149414a9763175a19d2dc651 (patch)
tree98170e6aeca907f029fe7b5abbbd2e7f2f4a5412 /ext/date/tests
parent832b62efb8fceebb220116d8024d945a9bd31d7e (diff)
downloadphp-upstream.tar.gz
New upstream version 5.6.6+dfsgupstream
Diffstat (limited to 'ext/date/tests')
-rw-r--r--ext/date/tests/010.phpt21
-rw-r--r--ext/date/tests/011.phpt2
-rw-r--r--ext/date/tests/DateTimeZone_listAbbreviations_basic1.phpt69
-rw-r--r--ext/date/tests/bug45081.phpt15
-rw-r--r--ext/date/tests/bug68942.phpt9
-rw-r--r--ext/date/tests/bug68942_2.phpt9
-rw-r--r--ext/date/tests/timezone_abbreviations_list_basic1.phpt69
7 files changed, 181 insertions, 13 deletions
diff --git a/ext/date/tests/010.phpt b/ext/date/tests/010.phpt
index 58b0ce80a..9f8c30a2e 100644
--- a/ext/date/tests/010.phpt
+++ b/ext/date/tests/010.phpt
@@ -8,7 +8,7 @@ date_default_timezone_set('UTC');
echo "Done\n";
?>
--EXPECTF--
-array(6) {
+array(7) {
[0]=>
array(3) {
["dst"]=>
@@ -16,7 +16,7 @@ array(6) {
["offset"]=>
int(0)
["timezone_id"]=>
- string(13) "Etc/Universal"
+ string(16) "Antarctica/Troll"
}
[1]=>
array(3) {
@@ -25,7 +25,7 @@ array(6) {
["offset"]=>
int(0)
["timezone_id"]=>
- string(7) "Etc/UTC"
+ string(13) "Etc/Universal"
}
[2]=>
array(3) {
@@ -34,7 +34,7 @@ array(6) {
["offset"]=>
int(0)
["timezone_id"]=>
- string(8) "Etc/Zulu"
+ string(7) "Etc/UTC"
}
[3]=>
array(3) {
@@ -43,7 +43,7 @@ array(6) {
["offset"]=>
int(0)
["timezone_id"]=>
- string(3) "GMT"
+ string(8) "Etc/Zulu"
}
[4]=>
array(3) {
@@ -52,7 +52,7 @@ array(6) {
["offset"]=>
int(0)
["timezone_id"]=>
- string(3) "UTC"
+ string(3) "GMT"
}
[5]=>
array(3) {
@@ -63,5 +63,14 @@ array(6) {
["timezone_id"]=>
string(3) "UTC"
}
+ [6]=>
+ array(3) {
+ ["dst"]=>
+ bool(false)
+ ["offset"]=>
+ int(0)
+ ["timezone_id"]=>
+ string(3) "UTC"
+ }
}
Done
diff --git a/ext/date/tests/011.phpt b/ext/date/tests/011.phpt
index 460e8c9d8..092a4b775 100644
--- a/ext/date/tests/011.phpt
+++ b/ext/date/tests/011.phpt
@@ -6,7 +6,7 @@ date_default_timezone_set('UTC');
var_dump(timezone_name_from_abbr());
var_dump(timezone_name_from_abbr("CET"));
-var_dump(timezone_name_from_abbr("AEST"));
+var_dump(timezone_name_from_abbr("AXST"));
var_dump(timezone_name_from_abbr("", 3600));
var_dump(timezone_name_from_abbr("", 3600, 0));
diff --git a/ext/date/tests/DateTimeZone_listAbbreviations_basic1.phpt b/ext/date/tests/DateTimeZone_listAbbreviations_basic1.phpt
index 015c9e8ec..e4a5dbd17 100644
--- a/ext/date/tests/DateTimeZone_listAbbreviations_basic1.phpt
+++ b/ext/date/tests/DateTimeZone_listAbbreviations_basic1.phpt
@@ -29,7 +29,7 @@ string(5) "array"
int(%d)
-- Format a sample entry --
-array(4) {
+array(11) {
[0]=>
array(3) {
["dst"]=>
@@ -42,13 +42,22 @@ array(4) {
[1]=>
array(3) {
["dst"]=>
+ bool(false)
+ ["offset"]=>
+ int(34200)
+ ["timezone_id"]=>
+ string(18) "Australia/Adelaide"
+ }
+ [2]=>
+ array(3) {
+ ["dst"]=>
bool(true)
["offset"]=>
int(-14400)
["timezone_id"]=>
string(16) "America/Eirunepe"
}
- [2]=>
+ [3]=>
array(3) {
["dst"]=>
bool(true)
@@ -57,7 +66,7 @@ array(4) {
["timezone_id"]=>
string(18) "America/Rio_Branco"
}
- [3]=>
+ [4]=>
array(3) {
["dst"]=>
bool(true)
@@ -66,5 +75,59 @@ array(4) {
["timezone_id"]=>
string(11) "Brazil/Acre"
}
+ [5]=>
+ array(3) {
+ ["dst"]=>
+ bool(false)
+ ["offset"]=>
+ int(34200)
+ ["timezone_id"]=>
+ string(13) "Asia/Jayapura"
+ }
+ [6]=>
+ array(3) {
+ ["dst"]=>
+ bool(false)
+ ["offset"]=>
+ int(34200)
+ ["timezone_id"]=>
+ string(21) "Australia/Broken_Hill"
+ }
+ [7]=>
+ array(3) {
+ ["dst"]=>
+ bool(false)
+ ["offset"]=>
+ int(34200)
+ ["timezone_id"]=>
+ string(16) "Australia/Darwin"
+ }
+ [8]=>
+ array(3) {
+ ["dst"]=>
+ bool(false)
+ ["offset"]=>
+ int(34200)
+ ["timezone_id"]=>
+ string(15) "Australia/North"
+ }
+ [9]=>
+ array(3) {
+ ["dst"]=>
+ bool(false)
+ ["offset"]=>
+ int(34200)
+ ["timezone_id"]=>
+ string(15) "Australia/South"
+ }
+ [10]=>
+ array(3) {
+ ["dst"]=>
+ bool(false)
+ ["offset"]=>
+ int(34200)
+ ["timezone_id"]=>
+ string(20) "Australia/Yancowinna"
+ }
}
===DONE===
diff --git a/ext/date/tests/bug45081.phpt b/ext/date/tests/bug45081.phpt
new file mode 100644
index 000000000..20733c686
--- /dev/null
+++ b/ext/date/tests/bug45081.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Bug #45081 (strtotime incorrectly interprets SGT time zone)
+--INI--
+date.timezone=Asia/Singapore
+--FILE--
+<?php
+
+print strtotime('2008-05-23 00:00:00 SGT');
+print "\n";
+print strtotime('2008-05-23 00:00:00');
+
+?>
+--EXPECTF--
+1211472000
+1211472000
diff --git a/ext/date/tests/bug68942.phpt b/ext/date/tests/bug68942.phpt
new file mode 100644
index 000000000..595cd9fa9
--- /dev/null
+++ b/ext/date/tests/bug68942.phpt
@@ -0,0 +1,9 @@
+--TEST--
+Bug #68942 (Use after free vulnerability in unserialize() with DateTimeZone).
+--FILE--
+<?php
+$data = unserialize('a:2:{i:0;O:12:"DateTimeZone":2:{s:13:"timezone_type";a:2:{i:0;i:1;i:1;i:2;}s:8:"timezone";s:1:"A";}i:1;R:4;}');
+var_dump($data);
+?>
+--EXPECTF--
+Fatal error: DateTimeZone::__wakeup(): Timezone initialization failed in %s/bug68942.php on line %d
diff --git a/ext/date/tests/bug68942_2.phpt b/ext/date/tests/bug68942_2.phpt
new file mode 100644
index 000000000..5b0256700
--- /dev/null
+++ b/ext/date/tests/bug68942_2.phpt
@@ -0,0 +1,9 @@
+--TEST--
+Bug #68942 (Use after free vulnerability in unserialize() with DateTime).
+--FILE--
+<?php
+$data = unserialize('a:2:{i:0;O:8:"DateTime":3:{s:4:"date";s:26:"2000-01-01 00:00:00.000000";s:13:"timezone_type";a:2:{i:0;i:1;i:1;i:2;}s:8:"timezone";s:1:"A";}i:1;R:5;}');
+var_dump($data);
+?>
+--EXPECTF--
+Fatal error: Invalid serialization data for DateTime object in %s/bug68942_2.php on line %d
diff --git a/ext/date/tests/timezone_abbreviations_list_basic1.phpt b/ext/date/tests/timezone_abbreviations_list_basic1.phpt
index e5dfe5d6a..73af2acf3 100644
--- a/ext/date/tests/timezone_abbreviations_list_basic1.phpt
+++ b/ext/date/tests/timezone_abbreviations_list_basic1.phpt
@@ -29,7 +29,7 @@ string(5) "array"
int(%d)
-- Format a sample entry --
-array(4) {
+array(11) {
[0]=>
array(3) {
["dst"]=>
@@ -42,13 +42,22 @@ array(4) {
[1]=>
array(3) {
["dst"]=>
+ bool(false)
+ ["offset"]=>
+ int(34200)
+ ["timezone_id"]=>
+ string(18) "Australia/Adelaide"
+ }
+ [2]=>
+ array(3) {
+ ["dst"]=>
bool(true)
["offset"]=>
int(-14400)
["timezone_id"]=>
string(16) "America/Eirunepe"
}
- [2]=>
+ [3]=>
array(3) {
["dst"]=>
bool(true)
@@ -57,7 +66,7 @@ array(4) {
["timezone_id"]=>
string(18) "America/Rio_Branco"
}
- [3]=>
+ [4]=>
array(3) {
["dst"]=>
bool(true)
@@ -66,5 +75,59 @@ array(4) {
["timezone_id"]=>
string(11) "Brazil/Acre"
}
+ [5]=>
+ array(3) {
+ ["dst"]=>
+ bool(false)
+ ["offset"]=>
+ int(34200)
+ ["timezone_id"]=>
+ string(13) "Asia/Jayapura"
+ }
+ [6]=>
+ array(3) {
+ ["dst"]=>
+ bool(false)
+ ["offset"]=>
+ int(34200)
+ ["timezone_id"]=>
+ string(21) "Australia/Broken_Hill"
+ }
+ [7]=>
+ array(3) {
+ ["dst"]=>
+ bool(false)
+ ["offset"]=>
+ int(34200)
+ ["timezone_id"]=>
+ string(16) "Australia/Darwin"
+ }
+ [8]=>
+ array(3) {
+ ["dst"]=>
+ bool(false)
+ ["offset"]=>
+ int(34200)
+ ["timezone_id"]=>
+ string(15) "Australia/North"
+ }
+ [9]=>
+ array(3) {
+ ["dst"]=>
+ bool(false)
+ ["offset"]=>
+ int(34200)
+ ["timezone_id"]=>
+ string(15) "Australia/South"
+ }
+ [10]=>
+ array(3) {
+ ["dst"]=>
+ bool(false)
+ ["offset"]=>
+ int(34200)
+ ["timezone_id"]=>
+ string(20) "Australia/Yancowinna"
+ }
}
===DONE===