summaryrefslogtreecommitdiff
path: root/ext/date/tests
diff options
context:
space:
mode:
authorSean Finney <seanius@debian.org>2009-04-10 14:09:48 +0200
committerSean Finney <seanius@debian.org>2009-04-10 14:09:48 +0200
commitcd0b49c72aee33b3e44a9c589fcd93b9e1c7a64f (patch)
tree1315c623bb7d9dfa8d366fa9cd2c6834ceeb5da5 /ext/date/tests
parent9ea47aab740772adf0c69d8c94b208a464e599ea (diff)
downloadphp-upstream/5.2.9.dfsg.1.tar.gz
Imported Upstream version 5.2.9.dfsg.1upstream/5.2.9.dfsg.1
Diffstat (limited to 'ext/date/tests')
-rw-r--r--ext/date/tests/bug43452.phpt71
-rw-r--r--ext/date/tests/bug46268.phpt23
-rw-r--r--ext/date/tests/date_default_timezone_get_error.phpt27
-rw-r--r--ext/date/tests/date_default_timezone_set_error.phpt41
-rw-r--r--ext/date/tests/date_default_timezone_set_variation1.phpt200
-rw-r--r--ext/date/tests/date_parse_001.phpt4
-rw-r--r--ext/date/tests/date_sun_info_error.phpt46
-rw-r--r--ext/date/tests/date_sun_info_variation1.phpt491
-rw-r--r--ext/date/tests/date_sun_info_variation2.phpt492
-rw-r--r--ext/date/tests/date_sun_info_variation3.phpt493
-rw-r--r--ext/date/tests/date_sunrise_and_sunset_basic.phpt28
-rw-r--r--ext/date/tests/date_sunrise_error.phpt41
-rw-r--r--ext/date/tests/date_sunrise_variation1.phpt315
-rw-r--r--ext/date/tests/date_sunrise_variation2.phpt212
-rw-r--r--ext/date/tests/date_sunrise_variation3.phpt294
-rw-r--r--ext/date/tests/date_sunrise_variation4.phpt296
-rw-r--r--ext/date/tests/date_sunrise_variation5.phpt296
-rw-r--r--ext/date/tests/date_sunrise_variation6.phpt295
-rw-r--r--ext/date/tests/date_sunrise_variation7.phpt57
-rw-r--r--ext/date/tests/date_sunrise_variation8.phpt73
-rw-r--r--ext/date/tests/date_sunrise_variation9.phpt47
-rw-r--r--ext/date/tests/date_sunset_error.phpt50
-rw-r--r--ext/date/tests/date_sunset_variation1.phpt316
-rw-r--r--ext/date/tests/date_sunset_variation2.phpt211
-rw-r--r--ext/date/tests/date_sunset_variation3.phpt297
-rw-r--r--ext/date/tests/date_sunset_variation4.phpt296
-rw-r--r--ext/date/tests/date_sunset_variation5.phpt296
-rw-r--r--ext/date/tests/date_sunset_variation6.phpt296
-rw-r--r--ext/date/tests/date_sunset_variation7.phpt75
-rw-r--r--ext/date/tests/date_sunset_variation8.phpt55
-rw-r--r--ext/date/tests/date_sunset_variation9.phpt47
-rw-r--r--ext/date/tests/getdate_basic.phpt76
-rw-r--r--ext/date/tests/getdate_error.phpt31
-rw-r--r--ext/date/tests/getdate_variation1.phpt444
-rw-r--r--ext/date/tests/getdate_variation2.phpt114
-rw-r--r--ext/date/tests/getdate_variation3.phpt114
-rw-r--r--ext/date/tests/getdate_variation4.phpt141
-rw-r--r--ext/date/tests/getdate_variation5.phpt223
-rw-r--r--ext/date/tests/getdate_variation6.phpt109
-rw-r--r--ext/date/tests/getdate_variation7.phpt78
-rw-r--r--ext/date/tests/gettimeofday_basic.phpt55
-rw-r--r--ext/date/tests/gettimeofday_error.phpt29
-rw-r--r--ext/date/tests/gettimeofday_variation1.phpt284
-rw-r--r--ext/date/tests/gmdate_basic.phpt30
-rw-r--r--ext/date/tests/gmdate_error.phpt41
-rw-r--r--ext/date/tests/gmdate_variation1.phpt221
-rw-r--r--ext/date/tests/gmdate_variation10.phpt69
-rw-r--r--ext/date/tests/gmdate_variation11.phpt45
-rw-r--r--ext/date/tests/gmdate_variation12.phpt48
-rw-r--r--ext/date/tests/gmdate_variation13.phpt82
-rw-r--r--ext/date/tests/gmdate_variation14.phpt34
-rw-r--r--ext/date/tests/gmdate_variation2.phpt210
-rw-r--r--ext/date/tests/gmdate_variation3.phpt59
-rw-r--r--ext/date/tests/gmdate_variation4.phpt45
-rw-r--r--ext/date/tests/gmdate_variation5.phpt29
-rw-r--r--ext/date/tests/gmdate_variation6.phpt61
-rw-r--r--ext/date/tests/gmdate_variation7.phpt60
-rw-r--r--ext/date/tests/gmdate_variation8.phpt60
-rw-r--r--ext/date/tests/gmdate_variation9.phpt81
-rw-r--r--ext/date/tests/gmmktime_basic.phpt35
-rw-r--r--ext/date/tests/gmmktime_error.phpt39
-rw-r--r--ext/date/tests/gmmktime_variation1.phpt194
-rw-r--r--ext/date/tests/gmmktime_variation2.phpt194
-rw-r--r--ext/date/tests/gmmktime_variation3.phpt194
-rw-r--r--ext/date/tests/gmmktime_variation4.phpt194
-rw-r--r--ext/date/tests/gmmktime_variation5.phpt194
-rw-r--r--ext/date/tests/gmmktime_variation6.phpt190
-rw-r--r--ext/date/tests/gmmktime_variation7.phpt54
-rw-r--r--ext/date/tests/gmmktime_variation8.phpt44
-rw-r--r--ext/date/tests/gmmktime_variation9.phpt62
-rw-r--r--ext/date/tests/gmstrftime_basic.phpt29
-rw-r--r--ext/date/tests/gmstrftime_error.phpt38
-rw-r--r--ext/date/tests/gmstrftime_variation1.phpt220
-rw-r--r--ext/date/tests/gmstrftime_variation10.phpt50
-rw-r--r--ext/date/tests/gmstrftime_variation11.phpt37
-rw-r--r--ext/date/tests/gmstrftime_variation12.phpt37
-rw-r--r--ext/date/tests/gmstrftime_variation13.phpt60
-rw-r--r--ext/date/tests/gmstrftime_variation14.phpt60
-rw-r--r--ext/date/tests/gmstrftime_variation15.phpt55
-rw-r--r--ext/date/tests/gmstrftime_variation16.phpt55
-rw-r--r--ext/date/tests/gmstrftime_variation17.phpt37
-rw-r--r--ext/date/tests/gmstrftime_variation18.phpt37
-rw-r--r--ext/date/tests/gmstrftime_variation19.phpt50
-rw-r--r--ext/date/tests/gmstrftime_variation2.phpt202
-rw-r--r--ext/date/tests/gmstrftime_variation20.phpt52
-rw-r--r--ext/date/tests/gmstrftime_variation21.phpt55
-rw-r--r--ext/date/tests/gmstrftime_variation22.phpt55
-rw-r--r--ext/date/tests/gmstrftime_variation3.phpt52
-rw-r--r--ext/date/tests/gmstrftime_variation4.phpt47
-rw-r--r--ext/date/tests/gmstrftime_variation5.phpt51
-rw-r--r--ext/date/tests/gmstrftime_variation6.phpt59
-rw-r--r--ext/date/tests/gmstrftime_variation7.phpt49
-rw-r--r--ext/date/tests/gmstrftime_variation8.phpt39
-rw-r--r--ext/date/tests/gmstrftime_variation9.phpt50
-rw-r--r--ext/date/tests/idate_basic.phpt24
-rw-r--r--ext/date/tests/idate_variation1.phpt301
-rw-r--r--ext/date/tests/idate_variation2.phpt191
-rw-r--r--ext/date/tests/idate_variation3.phpt35
-rw-r--r--ext/date/tests/idate_variation4.phpt66
-rw-r--r--ext/date/tests/idate_variation5.phpt62
-rw-r--r--ext/date/tests/idate_variation6.phpt34
-rw-r--r--ext/date/tests/localtime_basic.phpt93
-rw-r--r--ext/date/tests/localtime_variation1.phpt658
-rw-r--r--ext/date/tests/localtime_variation2.phpt643
-rw-r--r--ext/date/tests/localtime_variation3.phpt116
-rw-r--r--ext/date/tests/localtime_variation4.phpt162
-rw-r--r--ext/date/tests/localtime_variation5.phpt162
-rw-r--r--ext/date/tests/microtime_basic.phpt20
-rw-r--r--ext/date/tests/microtime_error.phpt72
-rw-r--r--ext/date/tests/mktime-3-64bit.phpt10
-rw-r--r--ext/date/tests/mktime-3.phpt7
-rw-r--r--ext/date/tests/strftime_basic.phpt30
-rw-r--r--ext/date/tests/strftime_error.phpt30
-rw-r--r--ext/date/tests/strftime_variation1.phpt222
-rw-r--r--ext/date/tests/strftime_variation10.phpt50
-rw-r--r--ext/date/tests/strftime_variation11.phpt37
-rw-r--r--ext/date/tests/strftime_variation12.phpt37
-rw-r--r--ext/date/tests/strftime_variation13.phpt60
-rw-r--r--ext/date/tests/strftime_variation14.phpt60
-rw-r--r--ext/date/tests/strftime_variation15.phpt55
-rw-r--r--ext/date/tests/strftime_variation16.phpt55
-rw-r--r--ext/date/tests/strftime_variation17.phpt36
-rw-r--r--ext/date/tests/strftime_variation18.phpt36
-rw-r--r--ext/date/tests/strftime_variation19.phpt50
-rw-r--r--ext/date/tests/strftime_variation2.phpt191
-rw-r--r--ext/date/tests/strftime_variation20.phpt52
-rw-r--r--ext/date/tests/strftime_variation21.phpt55
-rw-r--r--ext/date/tests/strftime_variation22.phpt55
-rw-r--r--ext/date/tests/strftime_variation23.phpt36
-rw-r--r--ext/date/tests/strftime_variation3.phpt52
-rw-r--r--ext/date/tests/strftime_variation4.phpt48
-rw-r--r--ext/date/tests/strftime_variation5.phpt50
-rw-r--r--ext/date/tests/strftime_variation6.phpt60
-rw-r--r--ext/date/tests/strftime_variation7.phpt50
-rw-r--r--ext/date/tests/strftime_variation8.phpt31
-rw-r--r--ext/date/tests/strftime_variation9.phpt50
-rw-r--r--ext/date/tests/strtotime_basic.phpt47
-rw-r--r--ext/date/tests/time_basic.phpt16
-rw-r--r--ext/date/tests/time_error.phpt20
139 files changed, 15744 insertions, 7 deletions
diff --git a/ext/date/tests/bug43452.phpt b/ext/date/tests/bug43452.phpt
new file mode 100644
index 000000000..25b4f0161
--- /dev/null
+++ b/ext/date/tests/bug43452.phpt
@@ -0,0 +1,71 @@
+--TEST--
+Bug #43452 ("weekday" is not equivalent to "1 weekday" of the current weekday is "weekday")
+--INI--
+date.timezone=Europe/Oslo
+--FILE--
+<?php
+// <day> is equivalent to 1 <day> and will *not* forward if the current day
+// (November 1st) is the same day of week.
+$day = strtotime( "Thursday Nov 2007" );
+echo date( DateTime::ISO8601, $day ), "\n";
+$day = strtotime( "1 Thursday Nov 2007" );
+echo date( DateTime::ISO8601, $day ), "\n";
+$day = strtotime( "2 Thursday Nov 2007" );
+echo date( DateTime::ISO8601, $day ), "\n";
+$day = strtotime( "3 Thursday Nov 2007" );
+echo date( DateTime::ISO8601, $day ), "\n\n";
+
+// forward one week, then behaves like above for week days
+$day = strtotime( "Thursday Nov 2007" );
+echo date( DateTime::ISO8601, $day ), "\n";
+$day = strtotime( "+1 week Thursday Nov 2007" );
+echo date( DateTime::ISO8601, $day ), "\n";
+$day = strtotime( "+2 week Thursday Nov 2007" );
+echo date( DateTime::ISO8601, $day ), "\n";
+$day = strtotime( "+3 week Thursday Nov 2007" );
+echo date( DateTime::ISO8601, $day ), "\n\n";
+
+// First, second, etc skip to the first/second weekday *after* the current day.
+// This makes "first thursday" equivalent to "+1 week thursday" - but only
+// if the current day-of-week is the one mentioned in the phrase.
+$day = strtotime( "Thursday Nov 2007" );
+echo date( DateTime::ISO8601, $day ), "\n";
+$day = strtotime( "first Thursday Nov 2007" );
+echo date( DateTime::ISO8601, $day ), "\n";
+$day = strtotime( "second Thursday Nov 2007" );
+echo date( DateTime::ISO8601, $day ), "\n";
+$day = strtotime( "third Thursday Nov 2007" );
+echo date( DateTime::ISO8601, $day ), "\n\n";
+
+// Now the same where the current day-of-week does not match the one in the
+// phrase.
+$day = strtotime( "Friday Nov 2007" );
+echo date( DateTime::ISO8601, $day ), "\n";
+$day = strtotime( "first Friday Nov 2007" );
+echo date( DateTime::ISO8601, $day ), "\n";
+$day = strtotime( "second Friday Nov 2007" );
+echo date( DateTime::ISO8601, $day ), "\n";
+$day = strtotime( "third Friday Nov 2007" );
+echo date( DateTime::ISO8601, $day ), "\n\n";
+
+?>
+--EXPECT--
+2007-11-01T00:00:00+0100
+2007-11-01T00:00:00+0100
+2007-11-08T00:00:00+0100
+2007-11-15T00:00:00+0100
+
+2007-11-01T00:00:00+0100
+2007-11-08T00:00:00+0100
+2007-11-15T00:00:00+0100
+2007-11-22T00:00:00+0100
+
+2007-11-01T00:00:00+0100
+2007-11-08T00:00:00+0100
+2007-11-15T00:00:00+0100
+2007-11-22T00:00:00+0100
+
+2007-11-02T00:00:00+0100
+2007-11-02T00:00:00+0100
+2007-11-09T00:00:00+0100
+2007-11-16T00:00:00+0100
diff --git a/ext/date/tests/bug46268.phpt b/ext/date/tests/bug46268.phpt
new file mode 100644
index 000000000..dd2d4a3ca
--- /dev/null
+++ b/ext/date/tests/bug46268.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Bug #46268 (When call DateTime#setTime, it seems to be called the last modify method too)
+--FILE--
+<?php
+date_default_timezone_set('Asia/Tokyo');
+
+$now = new DateTime('2008-10-10 01:02:03');
+echo $now->format("Y-m-d H:i:s") . PHP_EOL;
+
+$now->modify("1 day after");
+echo $now->format("Y-m-d H:i:s") . PHP_EOL;
+
+$now->modify("1 hour after");
+echo $now->format("Y-m-d H:i:s") . PHP_EOL;
+
+$now->setTime(0, 0, 0);
+//date_time_set($now, 0, 0, 0);
+echo $now->format("Y-m-d H:i:s") . PHP_EOL;
+--EXPECT--
+2008-10-10 01:02:03
+2008-10-11 01:02:03
+2008-10-11 02:02:03
+2008-10-11 00:00:00
diff --git a/ext/date/tests/date_default_timezone_get_error.phpt b/ext/date/tests/date_default_timezone_get_error.phpt
new file mode 100644
index 000000000..bf8bc8ef6
--- /dev/null
+++ b/ext/date/tests/date_default_timezone_get_error.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Test date_default_timezone_get() function : error conditions
+--FILE--
+<?php
+/* Prototype : string date_default_timezone_get ( void )
+ * Description: Gets the default timezone used by all date/time functions in a script.
+ * Source code: ext/standard/data/php_date.c
+ */
+
+date_default_timezone_set("UTC");
+
+echo "*** Testing date_default_timezone_get() : error conditions ***\n";
+
+echo "\n-- Testing date_create() function with more than expected no. of arguments --\n";
+$extra_arg = 99;
+var_dump( date_default_timezone_get($extra_arg));
+
+?>
+
+===Done===
+--EXPECTF--
+*** Testing date_default_timezone_get() : error conditions ***
+
+-- Testing date_create() function with more than expected no. of arguments --
+string(3) "UTC"
+
+===Done=== \ No newline at end of file
diff --git a/ext/date/tests/date_default_timezone_set_error.phpt b/ext/date/tests/date_default_timezone_set_error.phpt
new file mode 100644
index 000000000..15c6aa6fe
--- /dev/null
+++ b/ext/date/tests/date_default_timezone_set_error.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test date_default_timezone_set() function : error variations
+--FILE--
+<?php
+/* Prototype : bool date_default_timezone_set ( string $timezone_identifier )
+ * Description: Sets the default timezone used by all date/time functions in a script.
+ * Source code: ext/standard/data/php_date.c
+ */
+
+echo "*** Testing date_default_timezone_set() : error variations ***\n";
+
+echo "\n-- Testing date_default_timezone_set() function with less than expected no. of arguments --\n";
+var_dump( date_default_timezone_set() );
+
+echo "\n-- Testing date_default_timezone_set() function with more than expected no. of arguments --\n";
+$extra_arg = 10;
+var_dump( date_default_timezone_set("GMT", $extra_arg) );
+
+echo "\n-- Testing date_default_timezone_set() function with invalid timezone identifier --\n";
+var_dump( date_default_timezone_set("foo") );
+
+?>
+===Done===
+--EXPECTF--
+*** Testing date_default_timezone_set() : error variations ***
+
+-- Testing date_default_timezone_set() function with less than expected no. of arguments --
+
+Warning: date_default_timezone_set() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing date_default_timezone_set() function with more than expected no. of arguments --
+
+Warning: date_default_timezone_set() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+-- Testing date_default_timezone_set() function with invalid timezone identifier --
+
+Notice: date_default_timezone_set(): Timezone ID 'foo' is invalid in %s on line %d
+bool(false)
+===Done===
diff --git a/ext/date/tests/date_default_timezone_set_variation1.phpt b/ext/date/tests/date_default_timezone_set_variation1.phpt
new file mode 100644
index 000000000..22f4c22de
--- /dev/null
+++ b/ext/date/tests/date_default_timezone_set_variation1.phpt
@@ -0,0 +1,200 @@
+--TEST--
+Test date_default_timezone_set() function : usage variations - Passing unexpected values for time_zone identifier
+--FILE--
+<?php
+/* Prototype : bool date_default_timezone_set ( string $timezone_identifier )
+ * Description: Sets the default timezone used by all date/time functions in a script.
+ * Source code: ext/standard/data/php_date.c
+ */
+
+echo "*** Testing date_default_timezone_set() : usage variations ***\n";
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of date_default_timezone_set()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(date_default_timezone_set($input));
+ $iterator++;
+};
+?>
+===Done===
+--EXPECTF--
+*** Testing date_default_timezone_set() : usage variations ***
+
+-- Iteration 1 --
+
+Notice: date_default_timezone_set(): Timezone ID '0' is invalid in %s on line %d
+bool(false)
+
+-- Iteration 2 --
+
+Notice: date_default_timezone_set(): Timezone ID '1' is invalid in %s on line %d
+bool(false)
+
+-- Iteration 3 --
+
+Notice: date_default_timezone_set(): Timezone ID '12345' is invalid in %s on line %d
+bool(false)
+
+-- Iteration 4 --
+
+Notice: date_default_timezone_set(): Timezone ID '-2345' is invalid in %s on line %d
+bool(false)
+
+-- Iteration 5 --
+
+Notice: date_default_timezone_set(): Timezone ID '10.5' is invalid in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+
+Notice: date_default_timezone_set(): Timezone ID '-10.5' is invalid in %s on line %d
+bool(false)
+
+-- Iteration 7 --
+
+Notice: date_default_timezone_set(): Timezone ID '123456789000' is invalid in %s on line %d
+bool(false)
+
+-- Iteration 8 --
+
+Notice: date_default_timezone_set(): Timezone ID '1.23456789E-9' is invalid in %s on line %d
+bool(false)
+
+-- Iteration 9 --
+
+Notice: date_default_timezone_set(): Timezone ID '0.5' is invalid in %s on line %d
+bool(false)
+
+-- Iteration 10 --
+
+Notice: date_default_timezone_set(): Timezone ID '' is invalid in %s on line %d
+bool(false)
+
+-- Iteration 11 --
+
+Notice: date_default_timezone_set(): Timezone ID '' is invalid in %s on line %d
+bool(false)
+
+-- Iteration 12 --
+
+Notice: date_default_timezone_set(): Timezone ID '1' is invalid in %s on line %d
+bool(false)
+
+-- Iteration 13 --
+
+Notice: date_default_timezone_set(): Timezone ID '' is invalid in %s on line %d
+bool(false)
+
+-- Iteration 14 --
+
+Notice: date_default_timezone_set(): Timezone ID '1' is invalid in %s on line %d
+bool(false)
+
+-- Iteration 15 --
+
+Notice: date_default_timezone_set(): Timezone ID '' is invalid in %s on line %d
+bool(false)
+
+-- Iteration 16 --
+
+Notice: date_default_timezone_set(): Timezone ID '' is invalid in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+
+Notice: date_default_timezone_set(): Timezone ID '' is invalid in %s on line %d
+bool(false)
+
+-- Iteration 18 --
+
+Warning: date_default_timezone_set() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+-- Iteration 19 --
+
+Notice: date_default_timezone_set(): Timezone ID 'abcxyz' is invalid in %s on line %d
+bool(false)
+
+-- Iteration 20 --
+
+Notice: date_default_timezone_set(): Timezone ID 'abcxyz' is invalid in %s on line %d
+bool(false)
+
+-- Iteration 21 --
+
+Notice: date_default_timezone_set(): Timezone ID 'abc
+xyz' is invalid in %s on line %d
+bool(false)
+
+-- Iteration 22 --
+
+Notice: date_default_timezone_set(): Timezone ID '' is invalid in %s on line %d
+bool(false)
+
+-- Iteration 23 --
+
+Notice: date_default_timezone_set(): Timezone ID '' is invalid in %s on line %d
+bool(false)
+
+-- Iteration 24 --
+
+Warning: date_default_timezone_set() expects parameter 1 to be string, resource given in %s on line %d
+bool(false)
+===Done===
diff --git a/ext/date/tests/date_parse_001.phpt b/ext/date/tests/date_parse_001.phpt
index 205380fc9..542161016 100644
--- a/ext/date/tests/date_parse_001.phpt
+++ b/ext/date/tests/date_parse_001.phpt
@@ -79,7 +79,7 @@ array(15) {
["month"]=>
int(12)
["day"]=>
- bool(false)
+ int(1)
["hour"]=>
bool(false)
["minute"]=>
@@ -171,7 +171,7 @@ array(12) {
["month"]=>
int(3)
["day"]=>
- bool(false)
+ int(1)
["hour"]=>
bool(false)
["minute"]=>
diff --git a/ext/date/tests/date_sun_info_error.phpt b/ext/date/tests/date_sun_info_error.phpt
new file mode 100644
index 000000000..8d572479f
--- /dev/null
+++ b/ext/date/tests/date_sun_info_error.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Test date_sun_info() function : error variations
+--FILE--
+<?php
+/* Prototype : array date_sun_info ( int $time , float $latitude , float $longitude )
+ * Description: Returns an array with information about sunset/sunrise and twilight begin/end.
+ * Source code: ext/standard/data/php_date.c
+ */
+
+echo "*** Testing date_sun_info() : usage variations ***\n";
+
+$time = "2006-12-12";
+$latitude=31.7667;
+$longitude=35.2333;
+
+echo "\n-- Testing date_sun_info() function with less than expected no. of arguments --\n";
+var_dump( date_sun_info() );
+var_dump( date_sun_info($time) );
+var_dump( date_sun_info($time, $latitude) );
+
+
+echo "\n-- Testing date_sun_info() function with more than expected no. of arguments --\n";
+$extra_arg = 99;
+var_dump( date_create($time, $latitude, $longitude, $extra_arg) );
+
+?>
+===Done===
+--EXPECTF--
+*** Testing date_sun_info() : usage variations ***
+
+-- Testing date_sun_info() function with less than expected no. of arguments --
+
+Warning: date_sun_info() expects exactly 3 parameters, 0 given in %s on line %d
+bool(false)
+
+Warning: date_sun_info() expects exactly 3 parameters, 1 given in %s on line %d
+bool(false)
+
+Warning: date_sun_info() expects exactly 3 parameters, 2 given in %s on line %d
+bool(false)
+
+-- Testing date_sun_info() function with more than expected no. of arguments --
+
+Warning: date_create() expects at most 2 parameters, 4 given in %s on line %d
+bool(false)
+===Done=== \ No newline at end of file
diff --git a/ext/date/tests/date_sun_info_variation1.phpt b/ext/date/tests/date_sun_info_variation1.phpt
new file mode 100644
index 000000000..4df94c8b8
--- /dev/null
+++ b/ext/date/tests/date_sun_info_variation1.phpt
@@ -0,0 +1,491 @@
+--TEST--
+Test date_sun_info() function : error variations - Pass unexpected values for time argument
+--FILE--
+<?php
+/* Prototype : array date_sun_info ( int $time , float $latitude , float $longitude )
+ * Description: Returns an array with information about sunset/sunrise and twilight begin/end.
+ * Source code: ext/standard/data/php_date.c
+ */
+date_default_timezone_set("UTC");
+
+echo "*** Testing date_sun_info() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e5,
+ 12.3456789000E-5,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of date_sun_info()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(date_sun_info($input, 31.7667, 35.2333));
+ $iterator++;
+};
+
+?>
+===Done===
+--EXPECTF--
+*** Testing date_sun_info() : usage variations ***
+
+-- Iteration 1 --
+array(9) {
+ ["sunrise"]=>
+ int(16748)
+ ["sunset"]=>
+ int(53182)
+ ["transit"]=>
+ int(34965)
+ ["civil_twilight_begin"]=>
+ int(15145)
+ ["civil_twilight_end"]=>
+ int(54786)
+ ["nautical_twilight_begin"]=>
+ int(13324)
+ ["nautical_twilight_end"]=>
+ int(56607)
+ ["astronomical_twilight_begin"]=>
+ int(11542)
+ ["astronomical_twilight_end"]=>
+ int(58389)
+}
+
+-- Iteration 2 --
+array(9) {
+ ["sunrise"]=>
+ int(16748)
+ ["sunset"]=>
+ int(53182)
+ ["transit"]=>
+ int(34965)
+ ["civil_twilight_begin"]=>
+ int(15145)
+ ["civil_twilight_end"]=>
+ int(54786)
+ ["nautical_twilight_begin"]=>
+ int(13324)
+ ["nautical_twilight_end"]=>
+ int(56607)
+ ["astronomical_twilight_begin"]=>
+ int(11542)
+ ["astronomical_twilight_end"]=>
+ int(58389)
+}
+
+-- Iteration 3 --
+array(9) {
+ ["sunrise"]=>
+ int(16748)
+ ["sunset"]=>
+ int(53182)
+ ["transit"]=>
+ int(34965)
+ ["civil_twilight_begin"]=>
+ int(15145)
+ ["civil_twilight_end"]=>
+ int(54786)
+ ["nautical_twilight_begin"]=>
+ int(13324)
+ ["nautical_twilight_end"]=>
+ int(56607)
+ ["astronomical_twilight_begin"]=>
+ int(11542)
+ ["astronomical_twilight_end"]=>
+ int(58389)
+}
+
+-- Iteration 4 --
+array(9) {
+ ["sunrise"]=>
+ int(-69665)
+ ["sunset"]=>
+ int(-33260)
+ ["transit"]=>
+ int(-51462)
+ ["civil_twilight_begin"]=>
+ int(-71269)
+ ["civil_twilight_end"]=>
+ int(-31655)
+ ["nautical_twilight_begin"]=>
+ int(-73092)
+ ["nautical_twilight_end"]=>
+ int(-29832)
+ ["astronomical_twilight_begin"]=>
+ int(-74874)
+ ["astronomical_twilight_end"]=>
+ int(-28050)
+}
+
+-- Iteration 5 --
+array(9) {
+ ["sunrise"]=>
+ int(16748)
+ ["sunset"]=>
+ int(53182)
+ ["transit"]=>
+ int(34965)
+ ["civil_twilight_begin"]=>
+ int(15145)
+ ["civil_twilight_end"]=>
+ int(54786)
+ ["nautical_twilight_begin"]=>
+ int(13324)
+ ["nautical_twilight_end"]=>
+ int(56607)
+ ["astronomical_twilight_begin"]=>
+ int(11542)
+ ["astronomical_twilight_end"]=>
+ int(58389)
+}
+
+-- Iteration 6 --
+array(9) {
+ ["sunrise"]=>
+ int(-69665)
+ ["sunset"]=>
+ int(-33260)
+ ["transit"]=>
+ int(-51462)
+ ["civil_twilight_begin"]=>
+ int(-71269)
+ ["civil_twilight_end"]=>
+ int(-31655)
+ ["nautical_twilight_begin"]=>
+ int(-73092)
+ ["nautical_twilight_end"]=>
+ int(-29832)
+ ["astronomical_twilight_begin"]=>
+ int(-74874)
+ ["astronomical_twilight_end"]=>
+ int(-28050)
+}
+
+-- Iteration 7 --
+array(9) {
+ ["sunrise"]=>
+ int(1226363)
+ ["sunset"]=>
+ int(1263468)
+ ["transit"]=>
+ int(1244916)
+ ["civil_twilight_begin"]=>
+ int(1224788)
+ ["civil_twilight_end"]=>
+ int(1265044)
+ ["nautical_twilight_begin"]=>
+ int(1222993)
+ ["nautical_twilight_end"]=>
+ int(1266839)
+ ["astronomical_twilight_begin"]=>
+ int(1221233)
+ ["astronomical_twilight_end"]=>
+ int(1268599)
+}
+
+-- Iteration 8 --
+array(9) {
+ ["sunrise"]=>
+ int(16748)
+ ["sunset"]=>
+ int(53182)
+ ["transit"]=>
+ int(34965)
+ ["civil_twilight_begin"]=>
+ int(15145)
+ ["civil_twilight_end"]=>
+ int(54786)
+ ["nautical_twilight_begin"]=>
+ int(13324)
+ ["nautical_twilight_end"]=>
+ int(56607)
+ ["astronomical_twilight_begin"]=>
+ int(11542)
+ ["astronomical_twilight_end"]=>
+ int(58389)
+}
+
+-- Iteration 9 --
+array(9) {
+ ["sunrise"]=>
+ int(16748)
+ ["sunset"]=>
+ int(53182)
+ ["transit"]=>
+ int(34965)
+ ["civil_twilight_begin"]=>
+ int(15145)
+ ["civil_twilight_end"]=>
+ int(54786)
+ ["nautical_twilight_begin"]=>
+ int(13324)
+ ["nautical_twilight_end"]=>
+ int(56607)
+ ["astronomical_twilight_begin"]=>
+ int(11542)
+ ["astronomical_twilight_end"]=>
+ int(58389)
+}
+
+-- Iteration 10 --
+array(9) {
+ ["sunrise"]=>
+ int(16748)
+ ["sunset"]=>
+ int(53182)
+ ["transit"]=>
+ int(34965)
+ ["civil_twilight_begin"]=>
+ int(15145)
+ ["civil_twilight_end"]=>
+ int(54786)
+ ["nautical_twilight_begin"]=>
+ int(13324)
+ ["nautical_twilight_end"]=>
+ int(56607)
+ ["astronomical_twilight_begin"]=>
+ int(11542)
+ ["astronomical_twilight_end"]=>
+ int(58389)
+}
+
+-- Iteration 11 --
+array(9) {
+ ["sunrise"]=>
+ int(16748)
+ ["sunset"]=>
+ int(53182)
+ ["transit"]=>
+ int(34965)
+ ["civil_twilight_begin"]=>
+ int(15145)
+ ["civil_twilight_end"]=>
+ int(54786)
+ ["nautical_twilight_begin"]=>
+ int(13324)
+ ["nautical_twilight_end"]=>
+ int(56607)
+ ["astronomical_twilight_begin"]=>
+ int(11542)
+ ["astronomical_twilight_end"]=>
+ int(58389)
+}
+
+-- Iteration 12 --
+array(9) {
+ ["sunrise"]=>
+ int(16748)
+ ["sunset"]=>
+ int(53182)
+ ["transit"]=>
+ int(34965)
+ ["civil_twilight_begin"]=>
+ int(15145)
+ ["civil_twilight_end"]=>
+ int(54786)
+ ["nautical_twilight_begin"]=>
+ int(13324)
+ ["nautical_twilight_end"]=>
+ int(56607)
+ ["astronomical_twilight_begin"]=>
+ int(11542)
+ ["astronomical_twilight_end"]=>
+ int(58389)
+}
+
+-- Iteration 13 --
+array(9) {
+ ["sunrise"]=>
+ int(16748)
+ ["sunset"]=>
+ int(53182)
+ ["transit"]=>
+ int(34965)
+ ["civil_twilight_begin"]=>
+ int(15145)
+ ["civil_twilight_end"]=>
+ int(54786)
+ ["nautical_twilight_begin"]=>
+ int(13324)
+ ["nautical_twilight_end"]=>
+ int(56607)
+ ["astronomical_twilight_begin"]=>
+ int(11542)
+ ["astronomical_twilight_end"]=>
+ int(58389)
+}
+
+-- Iteration 14 --
+array(9) {
+ ["sunrise"]=>
+ int(16748)
+ ["sunset"]=>
+ int(53182)
+ ["transit"]=>
+ int(34965)
+ ["civil_twilight_begin"]=>
+ int(15145)
+ ["civil_twilight_end"]=>
+ int(54786)
+ ["nautical_twilight_begin"]=>
+ int(13324)
+ ["nautical_twilight_end"]=>
+ int(56607)
+ ["astronomical_twilight_begin"]=>
+ int(11542)
+ ["astronomical_twilight_end"]=>
+ int(58389)
+}
+
+-- Iteration 15 --
+array(9) {
+ ["sunrise"]=>
+ int(16748)
+ ["sunset"]=>
+ int(53182)
+ ["transit"]=>
+ int(34965)
+ ["civil_twilight_begin"]=>
+ int(15145)
+ ["civil_twilight_end"]=>
+ int(54786)
+ ["nautical_twilight_begin"]=>
+ int(13324)
+ ["nautical_twilight_end"]=>
+ int(56607)
+ ["astronomical_twilight_begin"]=>
+ int(11542)
+ ["astronomical_twilight_end"]=>
+ int(58389)
+}
+
+-- Iteration 16 --
+
+Warning: date_sun_info() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+
+Warning: date_sun_info() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+-- Iteration 18 --
+
+Warning: date_sun_info() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+-- Iteration 19 --
+
+Warning: date_sun_info() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+-- Iteration 20 --
+
+Warning: date_sun_info() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+-- Iteration 21 --
+
+Warning: date_sun_info() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+-- Iteration 22 --
+array(9) {
+ ["sunrise"]=>
+ int(16748)
+ ["sunset"]=>
+ int(53182)
+ ["transit"]=>
+ int(34965)
+ ["civil_twilight_begin"]=>
+ int(15145)
+ ["civil_twilight_end"]=>
+ int(54786)
+ ["nautical_twilight_begin"]=>
+ int(13324)
+ ["nautical_twilight_end"]=>
+ int(56607)
+ ["astronomical_twilight_begin"]=>
+ int(11542)
+ ["astronomical_twilight_end"]=>
+ int(58389)
+}
+
+-- Iteration 23 --
+array(9) {
+ ["sunrise"]=>
+ int(16748)
+ ["sunset"]=>
+ int(53182)
+ ["transit"]=>
+ int(34965)
+ ["civil_twilight_begin"]=>
+ int(15145)
+ ["civil_twilight_end"]=>
+ int(54786)
+ ["nautical_twilight_begin"]=>
+ int(13324)
+ ["nautical_twilight_end"]=>
+ int(56607)
+ ["astronomical_twilight_begin"]=>
+ int(11542)
+ ["astronomical_twilight_end"]=>
+ int(58389)
+}
+
+-- Iteration 24 --
+
+Warning: date_sun_info() expects parameter 1 to be long, resource given in %s on line %d
+bool(false)
+===Done=== \ No newline at end of file
diff --git a/ext/date/tests/date_sun_info_variation2.phpt b/ext/date/tests/date_sun_info_variation2.phpt
new file mode 100644
index 000000000..fb5ed317f
--- /dev/null
+++ b/ext/date/tests/date_sun_info_variation2.phpt
@@ -0,0 +1,492 @@
+--TEST--
+Test date_sun_info() function : error variations - Pass unexpected values for latitude argument
+--FILE--
+<?php
+/* Prototype : array date_sun_info ( int $time , float $latitude , float $longitude )
+ * Description: Returns an array with information about sunset/sunrise and twilight begin/end.
+ * Source code: ext/standard/data/php_date.c
+ */
+
+date_default_timezone_set("UTC");
+
+echo "*** Testing date_sun_info() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of date_sun_info()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(date_sun_info(strtotime("2006-12-12"), $input, 35.2333));
+ $iterator++;
+};
+
+?>
+===Done===
+--EXPECTF--
+*** Testing date_sun_info() : usage variations ***
+
+-- Iteration 1 --
+array(9) {
+ ["sunrise"]=>
+ int(1165894152)
+ ["sunset"]=>
+ int(1165937798)
+ ["transit"]=>
+ int(1165915975)
+ ["civil_twilight_begin"]=>
+ int(1165892809)
+ ["civil_twilight_end"]=>
+ int(1165939141)
+ ["nautical_twilight_begin"]=>
+ int(1165891239)
+ ["nautical_twilight_end"]=>
+ int(1165940710)
+ ["astronomical_twilight_begin"]=>
+ int(1165889663)
+ ["astronomical_twilight_end"]=>
+ int(1165942287)
+}
+
+-- Iteration 2 --
+array(9) {
+ ["sunrise"]=>
+ int(1165894254)
+ ["sunset"]=>
+ int(1165937695)
+ ["transit"]=>
+ int(1165915975)
+ ["civil_twilight_begin"]=>
+ int(1165892911)
+ ["civil_twilight_end"]=>
+ int(1165939038)
+ ["nautical_twilight_begin"]=>
+ int(1165891344)
+ ["nautical_twilight_end"]=>
+ int(1165940606)
+ ["astronomical_twilight_begin"]=>
+ int(1165889771)
+ ["astronomical_twilight_end"]=>
+ int(1165942179)
+}
+
+-- Iteration 3 --
+array(9) {
+ ["sunrise"]=>
+ bool(true)
+ ["sunset"]=>
+ bool(true)
+ ["transit"]=>
+ int(1165915975)
+ ["civil_twilight_begin"]=>
+ bool(true)
+ ["civil_twilight_end"]=>
+ bool(true)
+ ["nautical_twilight_begin"]=>
+ int(1165883331)
+ ["nautical_twilight_end"]=>
+ int(1165948619)
+ ["astronomical_twilight_begin"]=>
+ int(1165890260)
+ ["astronomical_twilight_end"]=>
+ int(1165941690)
+}
+
+-- Iteration 4 --
+array(9) {
+ ["sunrise"]=>
+ int(1165894085)
+ ["sunset"]=>
+ int(1165937865)
+ ["transit"]=>
+ int(1165915975)
+ ["civil_twilight_begin"]=>
+ int(1165895431)
+ ["civil_twilight_end"]=>
+ int(1165936519)
+ ["nautical_twilight_begin"]=>
+ int(1165896998)
+ ["nautical_twilight_end"]=>
+ int(1165934952)
+ ["astronomical_twilight_begin"]=>
+ int(1165898564)
+ ["astronomical_twilight_end"]=>
+ int(1165933386)
+}
+
+-- Iteration 5 --
+array(9) {
+ ["sunrise"]=>
+ int(1165895237)
+ ["sunset"]=>
+ int(1165936713)
+ ["transit"]=>
+ int(1165915975)
+ ["civil_twilight_begin"]=>
+ int(1165893873)
+ ["civil_twilight_end"]=>
+ int(1165938077)
+ ["nautical_twilight_begin"]=>
+ int(1165892293)
+ ["nautical_twilight_end"]=>
+ int(1165939656)
+ ["astronomical_twilight_begin"]=>
+ int(1165890721)
+ ["astronomical_twilight_end"]=>
+ int(1165941229)
+}
+
+-- Iteration 6 --
+array(9) {
+ ["sunrise"]=>
+ int(1165893058)
+ ["sunset"]=>
+ int(1165938891)
+ ["transit"]=>
+ int(1165915975)
+ ["civil_twilight_begin"]=>
+ int(1165891680)
+ ["civil_twilight_end"]=>
+ int(1165940269)
+ ["nautical_twilight_begin"]=>
+ int(1165890055)
+ ["nautical_twilight_end"]=>
+ int(1165941895)
+ ["astronomical_twilight_begin"]=>
+ int(1165888402)
+ ["astronomical_twilight_end"]=>
+ int(1165943548)
+}
+
+-- Iteration 7 --
+array(9) {
+ ["sunrise"]=>
+ int(1165894152)
+ ["sunset"]=>
+ int(1165937798)
+ ["transit"]=>
+ int(1165915975)
+ ["civil_twilight_begin"]=>
+ int(1165892809)
+ ["civil_twilight_end"]=>
+ int(1165939141)
+ ["nautical_twilight_begin"]=>
+ int(1165891239)
+ ["nautical_twilight_end"]=>
+ int(1165940710)
+ ["astronomical_twilight_begin"]=>
+ int(1165889663)
+ ["astronomical_twilight_end"]=>
+ int(1165942287)
+}
+
+-- Iteration 8 --
+array(9) {
+ ["sunrise"]=>
+ int(1165894152)
+ ["sunset"]=>
+ int(1165937798)
+ ["transit"]=>
+ int(1165915975)
+ ["civil_twilight_begin"]=>
+ int(1165892809)
+ ["civil_twilight_end"]=>
+ int(1165939141)
+ ["nautical_twilight_begin"]=>
+ int(1165891239)
+ ["nautical_twilight_end"]=>
+ int(1165940710)
+ ["astronomical_twilight_begin"]=>
+ int(1165889663)
+ ["astronomical_twilight_end"]=>
+ int(1165942287)
+}
+
+-- Iteration 9 --
+array(9) {
+ ["sunrise"]=>
+ int(1165894203)
+ ["sunset"]=>
+ int(1165937747)
+ ["transit"]=>
+ int(1165915975)
+ ["civil_twilight_begin"]=>
+ int(1165892860)
+ ["civil_twilight_end"]=>
+ int(1165939090)
+ ["nautical_twilight_begin"]=>
+ int(1165891292)
+ ["nautical_twilight_end"]=>
+ int(1165940658)
+ ["astronomical_twilight_begin"]=>
+ int(1165889717)
+ ["astronomical_twilight_end"]=>
+ int(1165942233)
+}
+
+-- Iteration 10 --
+array(9) {
+ ["sunrise"]=>
+ int(1165894152)
+ ["sunset"]=>
+ int(1165937798)
+ ["transit"]=>
+ int(1165915975)
+ ["civil_twilight_begin"]=>
+ int(1165892809)
+ ["civil_twilight_end"]=>
+ int(1165939141)
+ ["nautical_twilight_begin"]=>
+ int(1165891239)
+ ["nautical_twilight_end"]=>
+ int(1165940710)
+ ["astronomical_twilight_begin"]=>
+ int(1165889663)
+ ["astronomical_twilight_end"]=>
+ int(1165942287)
+}
+
+-- Iteration 11 --
+array(9) {
+ ["sunrise"]=>
+ int(1165894152)
+ ["sunset"]=>
+ int(1165937798)
+ ["transit"]=>
+ int(1165915975)
+ ["civil_twilight_begin"]=>
+ int(1165892809)
+ ["civil_twilight_end"]=>
+ int(1165939141)
+ ["nautical_twilight_begin"]=>
+ int(1165891239)
+ ["nautical_twilight_end"]=>
+ int(1165940710)
+ ["astronomical_twilight_begin"]=>
+ int(1165889663)
+ ["astronomical_twilight_end"]=>
+ int(1165942287)
+}
+
+-- Iteration 12 --
+array(9) {
+ ["sunrise"]=>
+ int(1165894254)
+ ["sunset"]=>
+ int(1165937695)
+ ["transit"]=>
+ int(1165915975)
+ ["civil_twilight_begin"]=>
+ int(1165892911)
+ ["civil_twilight_end"]=>
+ int(1165939038)
+ ["nautical_twilight_begin"]=>
+ int(1165891344)
+ ["nautical_twilight_end"]=>
+ int(1165940606)
+ ["astronomical_twilight_begin"]=>
+ int(1165889771)
+ ["astronomical_twilight_end"]=>
+ int(1165942179)
+}
+
+-- Iteration 13 --
+array(9) {
+ ["sunrise"]=>
+ int(1165894152)
+ ["sunset"]=>
+ int(1165937798)
+ ["transit"]=>
+ int(1165915975)
+ ["civil_twilight_begin"]=>
+ int(1165892809)
+ ["civil_twilight_end"]=>
+ int(1165939141)
+ ["nautical_twilight_begin"]=>
+ int(1165891239)
+ ["nautical_twilight_end"]=>
+ int(1165940710)
+ ["astronomical_twilight_begin"]=>
+ int(1165889663)
+ ["astronomical_twilight_end"]=>
+ int(1165942287)
+}
+
+-- Iteration 14 --
+array(9) {
+ ["sunrise"]=>
+ int(1165894254)
+ ["sunset"]=>
+ int(1165937695)
+ ["transit"]=>
+ int(1165915975)
+ ["civil_twilight_begin"]=>
+ int(1165892911)
+ ["civil_twilight_end"]=>
+ int(1165939038)
+ ["nautical_twilight_begin"]=>
+ int(1165891344)
+ ["nautical_twilight_end"]=>
+ int(1165940606)
+ ["astronomical_twilight_begin"]=>
+ int(1165889771)
+ ["astronomical_twilight_end"]=>
+ int(1165942179)
+}
+
+-- Iteration 15 --
+array(9) {
+ ["sunrise"]=>
+ int(1165894152)
+ ["sunset"]=>
+ int(1165937798)
+ ["transit"]=>
+ int(1165915975)
+ ["civil_twilight_begin"]=>
+ int(1165892809)
+ ["civil_twilight_end"]=>
+ int(1165939141)
+ ["nautical_twilight_begin"]=>
+ int(1165891239)
+ ["nautical_twilight_end"]=>
+ int(1165940710)
+ ["astronomical_twilight_begin"]=>
+ int(1165889663)
+ ["astronomical_twilight_end"]=>
+ int(1165942287)
+}
+
+-- Iteration 16 --
+
+Warning: date_sun_info() expects parameter 2 to be double, string given in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+
+Warning: date_sun_info() expects parameter 2 to be double, string given in %s on line %d
+bool(false)
+
+-- Iteration 18 --
+
+Warning: date_sun_info() expects parameter 2 to be double, array given in %s on line %d
+bool(false)
+
+-- Iteration 19 --
+
+Warning: date_sun_info() expects parameter 2 to be double, string given in %s on line %d
+bool(false)
+
+-- Iteration 20 --
+
+Warning: date_sun_info() expects parameter 2 to be double, string given in %s on line %d
+bool(false)
+
+-- Iteration 21 --
+
+Warning: date_sun_info() expects parameter 2 to be double, string given in %s on line %d
+bool(false)
+
+-- Iteration 22 --
+array(9) {
+ ["sunrise"]=>
+ int(1165894152)
+ ["sunset"]=>
+ int(1165937798)
+ ["transit"]=>
+ int(1165915975)
+ ["civil_twilight_begin"]=>
+ int(1165892809)
+ ["civil_twilight_end"]=>
+ int(1165939141)
+ ["nautical_twilight_begin"]=>
+ int(1165891239)
+ ["nautical_twilight_end"]=>
+ int(1165940710)
+ ["astronomical_twilight_begin"]=>
+ int(1165889663)
+ ["astronomical_twilight_end"]=>
+ int(1165942287)
+}
+
+-- Iteration 23 --
+array(9) {
+ ["sunrise"]=>
+ int(1165894152)
+ ["sunset"]=>
+ int(1165937798)
+ ["transit"]=>
+ int(1165915975)
+ ["civil_twilight_begin"]=>
+ int(1165892809)
+ ["civil_twilight_end"]=>
+ int(1165939141)
+ ["nautical_twilight_begin"]=>
+ int(1165891239)
+ ["nautical_twilight_end"]=>
+ int(1165940710)
+ ["astronomical_twilight_begin"]=>
+ int(1165889663)
+ ["astronomical_twilight_end"]=>
+ int(1165942287)
+}
+
+-- Iteration 24 --
+
+Warning: date_sun_info() expects parameter 2 to be double, resource given in %s on line %d
+bool(false)
+===Done===
diff --git a/ext/date/tests/date_sun_info_variation3.phpt b/ext/date/tests/date_sun_info_variation3.phpt
new file mode 100644
index 000000000..207d205d9
--- /dev/null
+++ b/ext/date/tests/date_sun_info_variation3.phpt
@@ -0,0 +1,493 @@
+--TEST--
+Test date_sun_info() function : usage variations - Pass unexpected values for longitude argument
+--FILE--
+<?php
+/* Prototype : array date_sun_info ( int $time , float $latitude , float $longitude )
+ * Description: Returns an array with information about sunset/sunrise and twilight begin/end.
+ * Source code: ext/standard/data/php_date.c
+ */
+
+date_default_timezone_set("UTC");
+
+echo "*** Testing date_sun_info() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of date_sun_info()
+$iterator = 1;
+
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(date_sun_info(strtotime("2006-12-12"), 31.7667, $input));
+ $iterator++;
+};
+
+?>
+===Done===
+--EXPECTF--
+*** Testing date_sun_info() : usage variations ***
+
+-- Iteration 1 --
+array(9) {
+ ["sunrise"]=>
+ int(1165906242)
+ ["sunset"]=>
+ int(1165942625)
+ ["transit"]=>
+ int(1165924434)
+ ["civil_twilight_begin"]=>
+ int(1165904636)
+ ["civil_twilight_end"]=>
+ int(1165944231)
+ ["nautical_twilight_begin"]=>
+ int(1165902813)
+ ["nautical_twilight_end"]=>
+ int(1165946054)
+ ["astronomical_twilight_begin"]=>
+ int(1165901030)
+ ["astronomical_twilight_end"]=>
+ int(1165947838)
+}
+
+-- Iteration 2 --
+array(9) {
+ ["sunrise"]=>
+ int(1165906002)
+ ["sunset"]=>
+ int(1165942385)
+ ["transit"]=>
+ int(1165924194)
+ ["civil_twilight_begin"]=>
+ int(1165904396)
+ ["civil_twilight_end"]=>
+ int(1165943991)
+ ["nautical_twilight_begin"]=>
+ int(1165902573)
+ ["nautical_twilight_end"]=>
+ int(1165945814)
+ ["astronomical_twilight_begin"]=>
+ int(1165900789)
+ ["astronomical_twilight_end"]=>
+ int(1165947598)
+}
+
+-- Iteration 3 --
+array(9) {
+ ["sunrise"]=>
+ int(1165879335)
+ ["sunset"]=>
+ int(1165917916)
+ ["transit"]=>
+ int(1165898625)
+ ["civil_twilight_begin"]=>
+ int(1165877811)
+ ["civil_twilight_end"]=>
+ int(1165919440)
+ ["nautical_twilight_begin"]=>
+ int(1165876064)
+ ["nautical_twilight_end"]=>
+ int(1165921187)
+ ["astronomical_twilight_begin"]=>
+ int(1165874341)
+ ["astronomical_twilight_end"]=>
+ int(1165922910)
+}
+
+-- Iteration 4 --
+array(9) {
+ ["sunrise"]=>
+ int(1165864483)
+ ["sunset"]=>
+ int(1165900762)
+ ["transit"]=>
+ int(1165882623)
+ ["civil_twilight_begin"]=>
+ int(1165862873)
+ ["civil_twilight_end"]=>
+ int(1165902372)
+ ["nautical_twilight_begin"]=>
+ int(1165861045)
+ ["nautical_twilight_end"]=>
+ int(1165904200)
+ ["astronomical_twilight_begin"]=>
+ int(1165859259)
+ ["astronomical_twilight_end"]=>
+ int(1165905987)
+}
+
+-- Iteration 5 --
+array(9) {
+ ["sunrise"]=>
+ int(1165903721)
+ ["sunset"]=>
+ int(1165940105)
+ ["transit"]=>
+ int(1165921913)
+ ["civil_twilight_begin"]=>
+ int(1165902115)
+ ["civil_twilight_end"]=>
+ int(1165941711)
+ ["nautical_twilight_begin"]=>
+ int(1165900292)
+ ["nautical_twilight_end"]=>
+ int(1165943534)
+ ["astronomical_twilight_begin"]=>
+ int(1165898508)
+ ["astronomical_twilight_end"]=>
+ int(1165945317)
+}
+
+-- Iteration 6 --
+array(9) {
+ ["sunrise"]=>
+ int(1165908763)
+ ["sunset"]=>
+ int(1165945146)
+ ["transit"]=>
+ int(1165926954)
+ ["civil_twilight_begin"]=>
+ int(1165907157)
+ ["civil_twilight_end"]=>
+ int(1165946752)
+ ["nautical_twilight_begin"]=>
+ int(1165905334)
+ ["nautical_twilight_end"]=>
+ int(1165948575)
+ ["astronomical_twilight_begin"]=>
+ int(1165903551)
+ ["astronomical_twilight_end"]=>
+ int(1165950358)
+}
+
+-- Iteration 7 --
+array(9) {
+ ["sunrise"]=>
+ int(1165919856)
+ ["sunset"]=>
+ int(1165969985)
+ ["transit"]=>
+ int(1165944920)
+ ["civil_twilight_begin"]=>
+ int(1165918203)
+ ["civil_twilight_end"]=>
+ int(1165971638)
+ ["nautical_twilight_begin"]=>
+ int(1165916223)
+ ["nautical_twilight_end"]=>
+ int(1165973617)
+ ["astronomical_twilight_begin"]=>
+ int(1165914116)
+ ["astronomical_twilight_end"]=>
+ int(1165975725)
+}
+
+-- Iteration 8 --
+array(9) {
+ ["sunrise"]=>
+ int(1165906242)
+ ["sunset"]=>
+ int(1165942625)
+ ["transit"]=>
+ int(1165924434)
+ ["civil_twilight_begin"]=>
+ int(1165904636)
+ ["civil_twilight_end"]=>
+ int(1165944231)
+ ["nautical_twilight_begin"]=>
+ int(1165902813)
+ ["nautical_twilight_end"]=>
+ int(1165946054)
+ ["astronomical_twilight_begin"]=>
+ int(1165901030)
+ ["astronomical_twilight_end"]=>
+ int(1165947838)
+}
+
+-- Iteration 9 --
+array(9) {
+ ["sunrise"]=>
+ int(1165906122)
+ ["sunset"]=>
+ int(1165942505)
+ ["transit"]=>
+ int(1165924314)
+ ["civil_twilight_begin"]=>
+ int(1165904516)
+ ["civil_twilight_end"]=>
+ int(1165944111)
+ ["nautical_twilight_begin"]=>
+ int(1165902693)
+ ["nautical_twilight_end"]=>
+ int(1165945934)
+ ["astronomical_twilight_begin"]=>
+ int(1165900910)
+ ["astronomical_twilight_end"]=>
+ int(1165947718)
+}
+
+-- Iteration 10 --
+array(9) {
+ ["sunrise"]=>
+ int(1165906242)
+ ["sunset"]=>
+ int(1165942625)
+ ["transit"]=>
+ int(1165924434)
+ ["civil_twilight_begin"]=>
+ int(1165904636)
+ ["civil_twilight_end"]=>
+ int(1165944231)
+ ["nautical_twilight_begin"]=>
+ int(1165902813)
+ ["nautical_twilight_end"]=>
+ int(1165946054)
+ ["astronomical_twilight_begin"]=>
+ int(1165901030)
+ ["astronomical_twilight_end"]=>
+ int(1165947838)
+}
+
+-- Iteration 11 --
+array(9) {
+ ["sunrise"]=>
+ int(1165906242)
+ ["sunset"]=>
+ int(1165942625)
+ ["transit"]=>
+ int(1165924434)
+ ["civil_twilight_begin"]=>
+ int(1165904636)
+ ["civil_twilight_end"]=>
+ int(1165944231)
+ ["nautical_twilight_begin"]=>
+ int(1165902813)
+ ["nautical_twilight_end"]=>
+ int(1165946054)
+ ["astronomical_twilight_begin"]=>
+ int(1165901030)
+ ["astronomical_twilight_end"]=>
+ int(1165947838)
+}
+
+-- Iteration 12 --
+array(9) {
+ ["sunrise"]=>
+ int(1165906002)
+ ["sunset"]=>
+ int(1165942385)
+ ["transit"]=>
+ int(1165924194)
+ ["civil_twilight_begin"]=>
+ int(1165904396)
+ ["civil_twilight_end"]=>
+ int(1165943991)
+ ["nautical_twilight_begin"]=>
+ int(1165902573)
+ ["nautical_twilight_end"]=>
+ int(1165945814)
+ ["astronomical_twilight_begin"]=>
+ int(1165900789)
+ ["astronomical_twilight_end"]=>
+ int(1165947598)
+}
+
+-- Iteration 13 --
+array(9) {
+ ["sunrise"]=>
+ int(1165906242)
+ ["sunset"]=>
+ int(1165942625)
+ ["transit"]=>
+ int(1165924434)
+ ["civil_twilight_begin"]=>
+ int(1165904636)
+ ["civil_twilight_end"]=>
+ int(1165944231)
+ ["nautical_twilight_begin"]=>
+ int(1165902813)
+ ["nautical_twilight_end"]=>
+ int(1165946054)
+ ["astronomical_twilight_begin"]=>
+ int(1165901030)
+ ["astronomical_twilight_end"]=>
+ int(1165947838)
+}
+
+-- Iteration 14 --
+array(9) {
+ ["sunrise"]=>
+ int(1165906002)
+ ["sunset"]=>
+ int(1165942385)
+ ["transit"]=>
+ int(1165924194)
+ ["civil_twilight_begin"]=>
+ int(1165904396)
+ ["civil_twilight_end"]=>
+ int(1165943991)
+ ["nautical_twilight_begin"]=>
+ int(1165902573)
+ ["nautical_twilight_end"]=>
+ int(1165945814)
+ ["astronomical_twilight_begin"]=>
+ int(1165900789)
+ ["astronomical_twilight_end"]=>
+ int(1165947598)
+}
+
+-- Iteration 15 --
+array(9) {
+ ["sunrise"]=>
+ int(1165906242)
+ ["sunset"]=>
+ int(1165942625)
+ ["transit"]=>
+ int(1165924434)
+ ["civil_twilight_begin"]=>
+ int(1165904636)
+ ["civil_twilight_end"]=>
+ int(1165944231)
+ ["nautical_twilight_begin"]=>
+ int(1165902813)
+ ["nautical_twilight_end"]=>
+ int(1165946054)
+ ["astronomical_twilight_begin"]=>
+ int(1165901030)
+ ["astronomical_twilight_end"]=>
+ int(1165947838)
+}
+
+-- Iteration 16 --
+
+Warning: date_sun_info() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+
+Warning: date_sun_info() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+-- Iteration 18 --
+
+Warning: date_sun_info() expects parameter 3 to be double, array given in %s on line %d
+bool(false)
+
+-- Iteration 19 --
+
+Warning: date_sun_info() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+-- Iteration 20 --
+
+Warning: date_sun_info() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+-- Iteration 21 --
+
+Warning: date_sun_info() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+-- Iteration 22 --
+array(9) {
+ ["sunrise"]=>
+ int(1165906242)
+ ["sunset"]=>
+ int(1165942625)
+ ["transit"]=>
+ int(1165924434)
+ ["civil_twilight_begin"]=>
+ int(1165904636)
+ ["civil_twilight_end"]=>
+ int(1165944231)
+ ["nautical_twilight_begin"]=>
+ int(1165902813)
+ ["nautical_twilight_end"]=>
+ int(1165946054)
+ ["astronomical_twilight_begin"]=>
+ int(1165901030)
+ ["astronomical_twilight_end"]=>
+ int(1165947838)
+}
+
+-- Iteration 23 --
+array(9) {
+ ["sunrise"]=>
+ int(1165906242)
+ ["sunset"]=>
+ int(1165942625)
+ ["transit"]=>
+ int(1165924434)
+ ["civil_twilight_begin"]=>
+ int(1165904636)
+ ["civil_twilight_end"]=>
+ int(1165944231)
+ ["nautical_twilight_begin"]=>
+ int(1165902813)
+ ["nautical_twilight_end"]=>
+ int(1165946054)
+ ["astronomical_twilight_begin"]=>
+ int(1165901030)
+ ["astronomical_twilight_end"]=>
+ int(1165947838)
+}
+
+-- Iteration 24 --
+
+Warning: date_sun_info() expects parameter 3 to be double, resource given in %s on line %d
+bool(false)
+===Done=== \ No newline at end of file
diff --git a/ext/date/tests/date_sunrise_and_sunset_basic.phpt b/ext/date/tests/date_sunrise_and_sunset_basic.phpt
new file mode 100644
index 000000000..ed68267ec
--- /dev/null
+++ b/ext/date/tests/date_sunrise_and_sunset_basic.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Basic test for date_sunrise and date_sunset based on example in PHP manual
+--FILE--
+<?php
+
+date_default_timezone_set('UTC');
+/* calculate the sunrise time for Lisbon, Portugal
+Latitude: 38.4 North
+Longitude: 9 West
+Zenith ~= 90
+offset: +1 GMT
+*/
+
+echo "Basic test for date_sunrise() and date_sunset()\n";
+
+// supress date() function strict msgs
+error_reporting(E_ALL & ~E_STRICT);
+
+echo date("D M d Y") . ', sunrise time : ' . date_sunrise(time(), SUNFUNCS_RET_STRING, 38.4, -9, 90, 1) . "\n";
+echo date("D M d Y") . ', sunset time : ' . date_sunset(time(), SUNFUNCS_RET_STRING, 38.4, -9, 90, 1) . "\n";
+
+?>
+===Done===
+--EXPECTF--
+Basic test for date_sunrise() and date_sunset()
+%s %s %d %d, sunrise time : %d:%d
+%s %s %d %d, sunset time : %d:%d
+===Done===
diff --git a/ext/date/tests/date_sunrise_error.phpt b/ext/date/tests/date_sunrise_error.phpt
new file mode 100644
index 000000000..f57b7ed1c
--- /dev/null
+++ b/ext/date/tests/date_sunrise_error.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test date_sunrise() function : error conditions
+--FILE--
+<?php
+/* Prototype : mixed date_sunrise(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
+ * Description: Returns time of sunrise for a given day and location
+ * Source code: ext/date/php_date.c
+ */
+
+echo "*** Testing date_sunrise() : error conditions ***\n";
+
+//Initialise the variables
+$time = time();
+$latitude = 38.4;
+$longitude = -9;
+$zenith = 90;
+$gmt_offset = 1;
+$extra_arg = 10;
+
+// Zero arguments
+echo "\n-- Testing date_sunrise() function with Zero arguments --\n";
+var_dump( date_sunrise() );
+
+//Test date_sunrise with one more than the expected number of arguments
+echo "\n-- Testing date_sunrise() function with more than expected no. of arguments --\n";
+var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $gmt_offset, $extra_arg) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_sunrise() : error conditions ***
+
+-- Testing date_sunrise() function with Zero arguments --
+
+Warning: date_sunrise() expects at least 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing date_sunrise() function with more than expected no. of arguments --
+
+Warning: date_sunrise() expects at most 6 parameters, 7 given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/date_sunrise_variation1.phpt b/ext/date/tests/date_sunrise_variation1.phpt
new file mode 100644
index 000000000..bf6b17ede
--- /dev/null
+++ b/ext/date/tests/date_sunrise_variation1.phpt
@@ -0,0 +1,315 @@
+--TEST--
+Test date_sunrise() function : usage variation - Passing unexpected values to first argument time.
+--FILE--
+<?php
+/* Prototype : mixed date_sunrise(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
+ * Description: Returns time of sunrise for a given day and location
+ * Source code: ext/date/php_date.c
+ */
+
+echo "*** Testing date_sunrise() : usage variation ***\n";
+
+//Initialise the variables
+$latitude = 38.4;
+$longitude = -9;
+$zenith = 90;
+$gmt_offset = 1;
+date_default_timezone_set("Asia/Calcutta");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for time
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( date_sunrise($value, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $gmt_offset) );
+ var_dump( date_sunrise($value, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $zenith, $gmt_offset) );
+ var_dump( date_sunrise($value, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $zenith, $gmt_offset) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_sunrise() : usage variation ***
+
+--int 0--
+string(5) "08:56"
+float(8.944%d)
+int(28599)
+
+--int 1--
+string(5) "08:56"
+float(8.944%d)
+int(28599)
+
+--int 12345--
+string(5) "08:56"
+float(8.944%d)
+int(28599)
+
+--int -12345--
+string(5) "08:56"
+float(8.944%d)
+int(28599)
+
+--float 10.5--
+string(5) "08:56"
+float(8.944%d)
+int(28599)
+
+--float -10.5--
+string(5) "08:56"
+float(8.944%d)
+int(28599)
+
+--float .5--
+string(5) "08:56"
+float(8.944%d)
+int(28599)
+
+--empty array--
+
+Warning: date_sunrise() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: date_sunrise() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: date_sunrise() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: date_sunrise() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+string(5) "08:56"
+float(8.944%d)
+int(28599)
+
+--lowercase null--
+string(5) "08:56"
+float(8.944%d)
+int(28599)
+
+--lowercase true--
+string(5) "08:56"
+float(8.944%d)
+int(28599)
+
+--lowercase false--
+string(5) "08:56"
+float(8.944%d)
+int(28599)
+
+--uppercase TRUE--
+string(5) "08:56"
+float(8.944%d)
+int(28599)
+
+--uppercase FALSE--
+string(5) "08:56"
+float(8.944%d)
+int(28599)
+
+--empty string DQ--
+
+Warning: date_sunrise() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: date_sunrise() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--string DQ--
+
+Warning: date_sunrise() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--string SQ--
+
+Warning: date_sunrise() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--mixed case string--
+
+Warning: date_sunrise() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--heredoc--
+
+Warning: date_sunrise() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: date_sunrise() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: date_sunrise() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+
+--undefined var--
+string(5) "08:56"
+float(8.944%d)
+int(28599)
+
+--unset var--
+string(5) "08:56"
+float(8.944%d)
+int(28599)
+===DONE===
diff --git a/ext/date/tests/date_sunrise_variation2.phpt b/ext/date/tests/date_sunrise_variation2.phpt
new file mode 100644
index 000000000..915b790bc
--- /dev/null
+++ b/ext/date/tests/date_sunrise_variation2.phpt
@@ -0,0 +1,212 @@
+--TEST--
+Test date_sunrise() function : usage variation - Passing unexpected values to second argument format.
+--FILE--
+<?php
+/* Prototype : mixed date_sunrise(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
+ * Description: Returns time of sunrise for a given day and location
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing date_sunrise() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+date_default_timezone_set("Asia/Calcutta");
+$time = mktime(8, 8, 8, 8, 8, 2008);
+$latitude = 38.4;
+$longitude = -9;
+$zenith = 90;
+$gmt_offset = 1;
+
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for format
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( date_sunrise($time, $value, $latitude, $longitude, $zenith, $gmt_offset) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_sunrise() : usage variation ***
+
+--float 10.5--
+
+Warning: date_sunrise(): Wrong return format given, pick one of SUNFUNCS_RET_TIMESTAMP, SUNFUNCS_RET_STRING or SUNFUNCS_RET_DOUBLE in %s on line %d
+bool(false)
+
+--float -10.5--
+
+Warning: date_sunrise(): Wrong return format given, pick one of SUNFUNCS_RET_TIMESTAMP, SUNFUNCS_RET_STRING or SUNFUNCS_RET_DOUBLE in %s on line %d
+bool(false)
+
+--float 12.3456789000e10--
+
+Warning: date_sunrise(): Wrong return format given, pick one of SUNFUNCS_RET_TIMESTAMP, SUNFUNCS_RET_STRING or SUNFUNCS_RET_DOUBLE in %s on line %d
+bool(false)
+
+--float -12.3456789000e10--
+
+Warning: date_sunrise(): Wrong return format given, pick one of SUNFUNCS_RET_TIMESTAMP, SUNFUNCS_RET_STRING or SUNFUNCS_RET_DOUBLE in %s on line %d
+bool(false)
+
+--float .5--
+int(1218174483)
+
+--empty array--
+
+Warning: date_sunrise() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: date_sunrise() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: date_sunrise() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: date_sunrise() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+int(1218174483)
+
+--lowercase null--
+int(1218174483)
+
+--lowercase true--
+string(5) "06:48"
+
+--lowercase false--
+int(1218174483)
+
+--uppercase TRUE--
+string(5) "06:48"
+
+--uppercase FALSE--
+int(1218174483)
+
+--empty string DQ--
+
+Warning: date_sunrise() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: date_sunrise() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--string DQ--
+
+Warning: date_sunrise() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--string SQ--
+
+Warning: date_sunrise() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--mixed case string--
+
+Warning: date_sunrise() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--heredoc--
+
+Warning: date_sunrise() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: date_sunrise() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: date_sunrise() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+
+--undefined var--
+int(1218174483)
+
+--unset var--
+int(1218174483)
+===DONE===
diff --git a/ext/date/tests/date_sunrise_variation3.phpt b/ext/date/tests/date_sunrise_variation3.phpt
new file mode 100644
index 000000000..46c5783c1
--- /dev/null
+++ b/ext/date/tests/date_sunrise_variation3.phpt
@@ -0,0 +1,294 @@
+--TEST--
+Test date_sunrise() function : usage variation - Passing unexpected values to third argument latitude.
+--FILE--
+<?php
+/* Prototype : mixed date_sunrise(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
+ * Description: Returns time of sunrise for a given day and location
+ * Source code: ext/date/php_date.c
+ */
+
+echo "*** Testing date_sunrise() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+date_default_timezone_set("Asia/Calcutta");
+$time = mktime(8, 8, 8, 8, 8, 2008);
+$longitude = -9;
+$zenith = 90;
+$gmt_offset = -5.5;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for latitude
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, $value, $longitude, $zenith, $gmt_offset) );
+ var_dump( date_sunrise($time, SUNFUNCS_RET_DOUBLE, $value, $longitude, $zenith, $gmt_offset) );
+ var_dump( date_sunrise($time, SUNFUNCS_RET_TIMESTAMP, $value, $longitude, $zenith, $gmt_offset) );
+};
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_sunrise() : usage variation ***
+
+--int 0--
+string(5) "01:10"
+float(1.174%d)
+int(1218177627)
+
+--int 1--
+string(5) "01:09"
+float(1.155%d)
+int(1218177558)
+
+--int 12345--
+bool(false)
+bool(false)
+bool(false)
+
+--int -12345--
+bool(false)
+bool(false)
+bool(false)
+
+--empty array--
+
+Warning: date_sunrise() expects parameter 3 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 3 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 3 to be double, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: date_sunrise() expects parameter 3 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 3 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 3 to be double, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: date_sunrise() expects parameter 3 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 3 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 3 to be double, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: date_sunrise() expects parameter 3 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 3 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 3 to be double, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+string(5) "01:10"
+float(1.174%d)
+int(1218177627)
+
+--lowercase null--
+string(5) "01:10"
+float(1.174%d)
+int(1218177627)
+
+--lowercase true--
+string(5) "01:09"
+float(1.155%d)
+int(1218177558)
+
+--lowercase false--
+string(5) "01:10"
+float(1.174%d)
+int(1218177627)
+
+--uppercase TRUE--
+string(5) "01:09"
+float(1.155%d)
+int(1218177558)
+
+--uppercase FALSE--
+string(5) "01:10"
+float(1.174%d)
+int(1218177627)
+
+--empty string DQ--
+
+Warning: date_sunrise() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: date_sunrise() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+--string DQ--
+
+Warning: date_sunrise() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+--string SQ--
+
+Warning: date_sunrise() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+--mixed case string--
+
+Warning: date_sunrise() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+--heredoc--
+
+Warning: date_sunrise() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: date_sunrise() expects parameter 3 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 3 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 3 to be double, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: date_sunrise() expects parameter 3 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 3 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 3 to be double, object given in %s on line %d
+bool(false)
+
+--undefined var--
+string(5) "01:10"
+float(1.174%d)
+int(1218177627)
+
+--unset var--
+string(5) "01:10"
+float(1.1742%d)
+int(1218177627)
+===DONE===
diff --git a/ext/date/tests/date_sunrise_variation4.phpt b/ext/date/tests/date_sunrise_variation4.phpt
new file mode 100644
index 000000000..c48f53831
--- /dev/null
+++ b/ext/date/tests/date_sunrise_variation4.phpt
@@ -0,0 +1,296 @@
+--TEST--
+Test date_sunrise() function : usage variation - Passing unexpected values to fourth argument longitude.
+--FILE--
+<?php
+/* Prototype : mixed date_sunrise(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
+ * Description: Returns time of sunrise for a given day and location
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing date_sunrise() : usage variation ***\n";
+
+//Initialise the variables
+date_default_timezone_set("Asia/Calcutta");
+$time = mktime(8, 8, 8, 8, 8, 2008);
+$latitude = 38.4;
+$zenith = 90;
+$gmt_offset = 0;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for longitude
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, $latitude, $value, $zenith, $gmt_offset) );
+ var_dump( date_sunrise($time, SUNFUNCS_RET_DOUBLE, $latitude, $value, $zenith, $gmt_offset) );
+ var_dump( date_sunrise($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $value, $zenith, $gmt_offset) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_sunrise() : usage variation ***
+
+--int 0--
+string(5) "05:12"
+float(5.200%d)
+int(1218172321)
+
+--int 1--
+string(5) "05:08"
+float(5.133%d)
+int(1218172081)
+
+--int 12345--
+string(5) "21:45"
+float(21.759%d)
+int(1218145534)
+
+--int -12345--
+string(5) "12:41"
+float(12.698%d)
+int(1218199315)
+
+--empty array--
+
+Warning: date_sunrise() expects parameter 4 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 4 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 4 to be double, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: date_sunrise() expects parameter 4 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 4 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 4 to be double, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: date_sunrise() expects parameter 4 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 4 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 4 to be double, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: date_sunrise() expects parameter 4 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 4 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 4 to be double, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+string(5) "05:12"
+float(5.200%d)
+int(1218172321)
+
+--lowercase null--
+string(5) "05:12"
+float(5.200%d)
+int(1218172321)
+
+--lowercase true--
+string(5) "05:08"
+float(5.133%d)
+int(1218172081)
+
+--lowercase false--
+string(5) "05:12"
+float(5.200%d)
+int(1218172321)
+
+--uppercase TRUE--
+string(5) "05:08"
+float(5.133%d)
+int(1218172081)
+
+--uppercase FALSE--
+string(5) "05:12"
+float(5.200%d)
+int(1218172321)
+
+--empty string DQ--
+
+Warning: date_sunrise() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: date_sunrise() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+--string DQ--
+
+Warning: date_sunrise() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+--string SQ--
+
+Warning: date_sunrise() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+--mixed case string--
+
+Warning: date_sunrise() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+--heredoc--
+
+Warning: date_sunrise() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: date_sunrise() expects parameter 4 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 4 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 4 to be double, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: date_sunrise() expects parameter 4 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 4 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 4 to be double, object given in %s on line %d
+bool(false)
+
+--undefined var--
+string(5) "05:12"
+float(5.200%d)
+int(1218172321)
+
+--unset var--
+string(5) "05:12"
+float(5.200%d)
+int(1218172321)
+===DONE===
diff --git a/ext/date/tests/date_sunrise_variation5.phpt b/ext/date/tests/date_sunrise_variation5.phpt
new file mode 100644
index 000000000..e697836d1
--- /dev/null
+++ b/ext/date/tests/date_sunrise_variation5.phpt
@@ -0,0 +1,296 @@
+--TEST--
+Test date_sunrise() function : usage variation - Passing unexpected values to fifth argument zenith
+--FILE--
+<?php
+/* Prototype : mixed date_sunrise(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
+ * Description: Returns time of sunrise for a given day and location
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing date_sunrise() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+date_default_timezone_set("Asia/Calcutta");
+$time = mktime(8, 8, 8, 8, 8, 2008);
+$latitude = 38.4;
+$longitude = -9;
+$gmt_offset = 5.5;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for zenith
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $value, $gmt_offset) );
+ var_dump( date_sunrise($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $value, $gmt_offset) );
+ var_dump( date_sunrise($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $value, $gmt_offset) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_sunrise() : usage variation ***
+
+--int 0--
+bool(false)
+bool(false)
+bool(false)
+
+--int 1--
+bool(false)
+bool(false)
+bool(false)
+
+--int 12345--
+string(5) "09:52"
+float(9.882%d)
+int(1218169377)
+
+--int -12345--
+string(5) "09:54"
+float(9.909%d)
+int(1218169475)
+
+--empty array--
+
+Warning: date_sunrise() expects parameter 5 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 5 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 5 to be double, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: date_sunrise() expects parameter 5 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 5 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 5 to be double, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: date_sunrise() expects parameter 5 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 5 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 5 to be double, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: date_sunrise() expects parameter 5 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 5 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 5 to be double, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+bool(false)
+bool(false)
+bool(false)
+
+--lowercase null--
+bool(false)
+bool(false)
+bool(false)
+
+--lowercase true--
+bool(false)
+bool(false)
+bool(false)
+
+--lowercase false--
+bool(false)
+bool(false)
+bool(false)
+
+--uppercase TRUE--
+bool(false)
+bool(false)
+bool(false)
+
+--uppercase FALSE--
+bool(false)
+bool(false)
+bool(false)
+
+--empty string DQ--
+
+Warning: date_sunrise() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: date_sunrise() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+--string DQ--
+
+Warning: date_sunrise() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+--string SQ--
+
+Warning: date_sunrise() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+--mixed case string--
+
+Warning: date_sunrise() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+--heredoc--
+
+Warning: date_sunrise() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: date_sunrise() expects parameter 5 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 5 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 5 to be double, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: date_sunrise() expects parameter 5 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 5 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 5 to be double, object given in %s on line %d
+bool(false)
+
+--undefined var--
+bool(false)
+bool(false)
+bool(false)
+
+--unset var--
+bool(false)
+bool(false)
+bool(false)
+===DONE===
diff --git a/ext/date/tests/date_sunrise_variation6.phpt b/ext/date/tests/date_sunrise_variation6.phpt
new file mode 100644
index 000000000..a96b95f56
--- /dev/null
+++ b/ext/date/tests/date_sunrise_variation6.phpt
@@ -0,0 +1,295 @@
+--TEST--
+Test date_sunrise() function : usage variation - Passing unexpected values to sixth argument gmt_offset.
+--FILE--
+<?php
+/* Prototype : mixed date_sunrise(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
+ * Description: Returns time of sunrise for a given day and location
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing date_sunrise() : usage variation ***\n";
+// Initialise function arguments not being substituted (if any)
+date_default_timezone_set("Asia/Calcutta");
+$time = mktime(8, 8, 8, 8, 8, 2008);
+$latitude = 38.4;
+$longitude = -9;
+$zenith = 90;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for gmt_offset
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $value) );
+ var_dump( date_sunrise($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $zenith, $value) );
+ var_dump( date_sunrise($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $zenith, $value) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_sunrise() : usage variation ***
+
+--int 0--
+string(5) "05:48"
+float(5.800%d)
+int(1218174483)
+
+--int 1--
+string(5) "06:48"
+float(6.800%d)
+int(1218174483)
+
+--int 12345--
+string(5) "14:48"
+float(14.800%d)
+int(1218174483)
+
+--int -12345--
+string(5) "12:48"
+float(12.800%d)
+int(1218174483)
+
+--empty array--
+
+Warning: date_sunrise() expects parameter 6 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 6 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 6 to be double, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: date_sunrise() expects parameter 6 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 6 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 6 to be double, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: date_sunrise() expects parameter 6 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 6 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 6 to be double, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: date_sunrise() expects parameter 6 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 6 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 6 to be double, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+string(5) "05:48"
+float(5.800%d)
+int(1218174483)
+
+--lowercase null--
+string(5) "05:48"
+float(5.800%d)
+int(1218174483)
+
+--lowercase true--
+string(5) "06:48"
+float(6.800%d)
+int(1218174483)
+
+--lowercase false--
+string(5) "05:48"
+float(5.800%d)
+int(1218174483)
+
+--uppercase TRUE--
+string(5) "06:48"
+float(6.800%d)
+int(1218174483)
+
+--uppercase FALSE--
+string(5) "05:48"
+float(5.800%d)
+int(1218174483)
+
+--empty string DQ--
+
+Warning: date_sunrise() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: date_sunrise() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+--string DQ--
+
+Warning: date_sunrise() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+--string SQ--
+
+Warning: date_sunrise() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+--mixed case string--
+
+Warning: date_sunrise() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+--heredoc--
+
+Warning: date_sunrise() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: date_sunrise() expects parameter 6 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 6 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 6 to be double, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: date_sunrise() expects parameter 6 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 6 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 6 to be double, object given in %s on line %d
+bool(false)
+
+--undefined var--
+string(5) "05:48"
+float(5.800%d)
+int(1218174483)
+
+--unset var--
+string(5) "05:48"
+float(5.800%d)
+int(1218174483)
+===DONE===
diff --git a/ext/date/tests/date_sunrise_variation7.phpt b/ext/date/tests/date_sunrise_variation7.phpt
new file mode 100644
index 000000000..fa5f363a5
--- /dev/null
+++ b/ext/date/tests/date_sunrise_variation7.phpt
@@ -0,0 +1,57 @@
+--TEST--
+Test date_sunrise() function : usage variation - Checking sunrise for consecutive days in specific timezone
+--FILE--
+<?php
+/* Prototype : mixed date_sunrise(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
+ * Description: Returns time of sunrise for a given day and location
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing date_sunrise() : usage variation ***\n";
+
+//Timezones with required data for date_sunrise
+$inputs = array (
+ //Timezone with Latitude, Longitude and GMT offset
+ "Pacific/Samoa" => array ("Latitude" => -14.24, "Longitude" => -170.72, "GMT" => -11),
+ "US/Alaska" => array ("Latitude" => 61, "Longitude" => -150 , "GMT" => -9),
+ "America/Chicago" => array ("Latitude" => 41.85, "Longitude" => -87.65 , "GMT" => -5),
+ "America/Montevideo" => array ("Latitude" => -34.88, "Longitude" => -56.18 , "GMT" => -3),
+ "Africa/Casablanca" => array ("Latitude" => 33.65, "Longitude" => -7.58, "GMT" => 0),
+ "Europe/Moscow" => array ("Latitude" => 55.75, "Longitude" => 37.58, "GMT" => 4),
+ "Asia/Hong_Kong" => array ("Latitude" => 22.28, "Longitude" => 114.15 , "GMT" => 8),
+ "Australia/Brisbane" => array ("Latitude" => -27.46, "Longitude" => 153.2 , "GMT" => 10),
+ "Pacific/Wallis" => array ("Latitude" => -13.3, "Longitude" => -176.16, "GMT" => 12),
+);
+
+foreach($inputs as $timezone => $value) {
+ date_default_timezone_set($timezone);
+ $time = mktime(8, 8, 8, 8, 11, 2008);
+ var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, $value["Latitude"], $value["Longitude"], 90, $value["GMT"] ));
+ $time = mktime(8, 8, 8, 8, 12, 2008);
+ var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, $value["Latitude"], $value["Longitude"], 90, $value["GMT"]) );
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_sunrise() : usage variation ***
+string(5) "06:41"
+string(5) "06:41"
+string(5) "05:09"
+string(5) "05:11"
+string(5) "05:59"
+string(5) "06:00"
+string(5) "07:30"
+string(5) "07:29"
+string(5) "05:53"
+string(5) "05:53"
+string(5) "05:59"
+string(5) "06:01"
+string(5) "06:01"
+string(5) "06:02"
+string(5) "06:23"
+string(5) "06:22"
+string(5) "06:03"
+string(5) "06:02"
+===DONE===
diff --git a/ext/date/tests/date_sunrise_variation8.phpt b/ext/date/tests/date_sunrise_variation8.phpt
new file mode 100644
index 000000000..1d22be8c8
--- /dev/null
+++ b/ext/date/tests/date_sunrise_variation8.phpt
@@ -0,0 +1,73 @@
+--TEST--
+Test date_sunrise() function : usage variation - Checking with North and South poles when Sun is up and down all day
+--FILE--
+<?php
+/* Prototype : mixed date_sunrise(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
+ * Description: Returns time of sunrise for a given day and location
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing date_sunrise() : usage variation ***\n";
+
+// GMT is zero for the timezone
+date_default_timezone_set("Africa/Casablanca");
+$time_date = array (
+
+ //Date at which Sun is up all day at North Pole
+ "12 Aug 2008" => mktime(8, 8, 8, 8, 12, 2008),
+ "13 Aug 2008" => mktime(8, 8, 8, 8, 13, 2008),
+
+ //Date at which Sun is up all day at South Pole
+ "12 Nov 2008" => mktime(8, 8, 8, 11, 12, 2008),
+ "13 Nov 2008" => mktime(8, 8, 8, 11, 13, 2008),
+);
+
+//Iterate over different date and time
+foreach( $time_date as $date => $time ){
+ echo "\n--$date--\n";
+ var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, 90, 0 ) );
+ var_dump( date_sunrise($time, SUNFUNCS_RET_DOUBLE, 90, 0 ) );
+ var_dump( date_sunrise($time, SUNFUNCS_RET_TIMESTAMP, 90, 0 ) );
+ var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, -90, 0 ) );
+ var_dump( date_sunrise($time, SUNFUNCS_RET_DOUBLE, -90, 0 ) );
+ var_dump( date_sunrise($time, SUNFUNCS_RET_TIMESTAMP, -90, 0 ) );
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_sunrise() : usage variation ***
+
+--12 Aug 2008--
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+--13 Aug 2008--
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+--12 Nov 2008--
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+--13 Nov 2008--
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+===DONE===
diff --git a/ext/date/tests/date_sunrise_variation9.phpt b/ext/date/tests/date_sunrise_variation9.phpt
new file mode 100644
index 000000000..49af06d52
--- /dev/null
+++ b/ext/date/tests/date_sunrise_variation9.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test date_sunrise() function : usage variation - Passing high positive and negative float values to time argument.
+--FILE--
+<?php
+/* Prototype : mixed date_sunrise(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
+ * Description: Returns time of sunrise for a given day and location
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing date_sunrise() : usage variation ***\n";
+
+// GMT is zero for the timezone
+date_default_timezone_set("Asia/Calcutta");
+//Initialise the variables
+$latitude = 38.4;
+$longitude = -9;
+$zenith = 90;
+$gmt_offset = 1;
+
+echo "\n-- Testing date_sunrise() function by passing float 12.3456789000e10 value to time --\n";
+$time = 12.3456789000e10;
+var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $gmt_offset) );
+var_dump( date_sunrise($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $zenith, $gmt_offset) );
+var_dump( date_sunrise($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $zenith, $gmt_offset) );
+
+echo "\n-- Testing date_sunrise() function by passing float -12.3456789000e10 value to time --\n";
+$time = -12.3456789000e10;
+var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $gmt_offset) );
+var_dump( date_sunrise($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $zenith, $gmt_offset) );
+var_dump( date_sunrise($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $zenith, $gmt_offset) );
+
+?>
+===DONE===
+--EXPECTREGEX--
+\*\*\* Testing date_sunrise\(\) : usage variation \*\*\*
+
+-- Testing date_sunrise\(\) function by passing float 12.3456789000e10 value to time --
+string\(5\) "(07:34|07:49)"
+float\((7.566[0-9]*|7.821[0-9]*)\)
+int\((-1097256359|123456811756)\)
+
+-- Testing date_sunrise\(\) function by passing float -12.3456789000e10 value to time --
+string\(5\) "(07:42|08:48|08:04)"
+float\((7.713[0-9]*|8.810[0-9]*|8.074[0-9]*)\)
+int\((1097304168|-2147443882|-123456761731)\)
+===DONE===
diff --git a/ext/date/tests/date_sunset_error.phpt b/ext/date/tests/date_sunset_error.phpt
new file mode 100644
index 000000000..a5e75b649
--- /dev/null
+++ b/ext/date/tests/date_sunset_error.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Test date_sunset() function : error conditions
+--FILE--
+<?php
+/* Prototype : mixed date_sunset(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
+ * Description: Returns time of sunset for a given day and location
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing date_sunset() : error conditions ***\n";
+
+//Initialise the variables
+$time = time();
+$latitude = 38.4;
+$longitude = -9;
+$zenith = 90;
+$gmt_offset = 1;
+$extra_arg = 10;
+
+// Zero arguments
+echo "\n-- Testing date_sunset() function with Zero arguments --\n";
+var_dump( date_sunset() );
+
+//Test date_sunset with one more than the expected number of arguments
+echo "\n-- Testing date_sunset() function with more than expected no. of arguments --\n";
+var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $gmt_offset, $extra_arg) );
+var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $zenith, $gmt_offset, $extra_arg) );
+var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $zenith, $gmt_offset, $extra_arg) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_sunset() : error conditions ***
+
+-- Testing date_sunset() function with Zero arguments --
+
+Warning: date_sunset() expects at least 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing date_sunset() function with more than expected no. of arguments --
+
+Warning: date_sunset() expects at most 6 parameters, 7 given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects at most 6 parameters, 7 given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects at most 6 parameters, 7 given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/date_sunset_variation1.phpt b/ext/date/tests/date_sunset_variation1.phpt
new file mode 100644
index 000000000..c2e119571
--- /dev/null
+++ b/ext/date/tests/date_sunset_variation1.phpt
@@ -0,0 +1,316 @@
+--TEST--
+Test date_sunset() function : usage variation - Passing unexpected values to first argument time.
+--FILE--
+<?php
+/* Prototype : mixed date_sunset(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
+ * Description: Returns time of sunset for a given day and location
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing date_sunset() : usage variation ***\n";
+
+//Initialise the variables
+$latitude = 38.4;
+$longitude = -9;
+$zenith = 90;
+$gmt_offset = 1;
+date_default_timezone_set("Asia/Calcutta");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for time
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( date_sunset($value, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $gmt_offset) );
+ var_dump( date_sunset($value, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $zenith, $gmt_offset) );
+ var_dump( date_sunset($value, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $zenith, $gmt_offset) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_sunset() : usage variation ***
+
+--int 0--
+string(5) "18:22"
+float(18.377%d)
+int(62558)
+
+--int 1--
+string(5) "18:22"
+float(18.377%d)
+int(62558)
+
+--int 12345--
+string(5) "18:22"
+float(18.377%d)
+int(62558)
+
+--int -12345--
+string(5) "18:22"
+float(18.377%d)
+int(62558)
+
+--float 10.5--
+string(5) "18:22"
+float(18.377%d)
+int(62558)
+
+--float -10.5--
+string(5) "18:22"
+float(18.377%d)
+int(62558)
+
+--float .5--
+string(5) "18:22"
+float(18.377%d)
+int(62558)
+
+--empty array--
+
+Warning: date_sunset() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: date_sunset() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: date_sunset() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: date_sunset() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+string(5) "18:22"
+float(18.377%d)
+int(62558)
+
+--lowercase null--
+string(5) "18:22"
+float(18.377%d)
+int(62558)
+
+--lowercase true--
+string(5) "18:22"
+float(18.377%d)
+int(62558)
+
+--lowercase false--
+string(5) "18:22"
+float(18.377%d)
+int(62558)
+
+--uppercase TRUE--
+string(5) "18:22"
+float(18.377%d)
+int(62558)
+
+--uppercase FALSE--
+string(5) "18:22"
+float(18.377%d)
+int(62558)
+
+--empty string DQ--
+
+Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--string DQ--
+
+Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--string SQ--
+
+Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--mixed case string--
+
+Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--heredoc--
+
+Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: date_sunset() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: date_sunset() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+
+--undefined var--
+string(5) "18:22"
+float(18.377%d)
+int(62558)
+
+--unset var--
+string(5) "18:22"
+float(18.377%d)
+int(62558)
+===DONE===
diff --git a/ext/date/tests/date_sunset_variation2.phpt b/ext/date/tests/date_sunset_variation2.phpt
new file mode 100644
index 000000000..575b64a22
--- /dev/null
+++ b/ext/date/tests/date_sunset_variation2.phpt
@@ -0,0 +1,211 @@
+--TEST--
+Test date_sunset() function : usage variation - Passing unexpected values to second argument format.
+--FILE--
+<?php
+/* Prototype : mixed date_sunset(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
+ * Description: Returns time of sunset for a given day and location
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing date_sunset() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+date_default_timezone_set("Asia/Calcutta");
+$time = mktime(8, 8, 8, 8, 8, 2008);
+$latitude = 22.34;
+$longitude = 88.21;
+$zenith = 90;
+$gmt_offset = 5.5;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for format
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( date_sunset($time, $value, $latitude, $longitude, $zenith, $gmt_offset) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_sunset() : usage variation ***
+
+--float 10.5--
+
+Warning: date_sunset(): Wrong return format given, pick one of SUNFUNCS_RET_TIMESTAMP, SUNFUNCS_RET_STRING or SUNFUNCS_RET_DOUBLE in %s on line %d
+bool(false)
+
+--float -10.5--
+
+Warning: date_sunset(): Wrong return format given, pick one of SUNFUNCS_RET_TIMESTAMP, SUNFUNCS_RET_STRING or SUNFUNCS_RET_DOUBLE in %s on line %d
+bool(false)
+
+--float 12.3456789000e10--
+
+Warning: date_sunset(): Wrong return format given, pick one of SUNFUNCS_RET_TIMESTAMP, SUNFUNCS_RET_STRING or SUNFUNCS_RET_DOUBLE in %s on line %d
+bool(false)
+
+--float -12.3456789000e10--
+
+Warning: date_sunset(): Wrong return format given, pick one of SUNFUNCS_RET_TIMESTAMP, SUNFUNCS_RET_STRING or SUNFUNCS_RET_DOUBLE in %s on line %d
+bool(false)
+
+--float .5--
+int(1218199253)
+
+--empty array--
+
+Warning: date_sunset() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: date_sunset() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: date_sunset() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: date_sunset() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+int(1218199253)
+
+--lowercase null--
+int(1218199253)
+
+--lowercase true--
+string(5) "18:10"
+
+--lowercase false--
+int(1218199253)
+
+--uppercase TRUE--
+string(5) "18:10"
+
+--uppercase FALSE--
+int(1218199253)
+
+--empty string DQ--
+
+Warning: date_sunset() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: date_sunset() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--string DQ--
+
+Warning: date_sunset() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--string SQ--
+
+Warning: date_sunset() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--mixed case string--
+
+Warning: date_sunset() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--heredoc--
+
+Warning: date_sunset() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: date_sunset() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: date_sunset() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+
+--undefined var--
+int(1218199253)
+
+--unset var--
+int(1218199253)
+===DONE===
diff --git a/ext/date/tests/date_sunset_variation3.phpt b/ext/date/tests/date_sunset_variation3.phpt
new file mode 100644
index 000000000..142cb9d0b
--- /dev/null
+++ b/ext/date/tests/date_sunset_variation3.phpt
@@ -0,0 +1,297 @@
+--TEST--
+Test date_sunset() function : usage variation - Passing unexpected values to third argument latitude.
+--FILE--
+<?php
+/* Prototype : mixed date_sunset(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
+ * Description: Returns time of sunset for a given day and location
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing date_sunset() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+date_default_timezone_set("Asia/Calcutta");
+$time = mktime(8, 8, 8, 8, 8, 2008);
+$longitude = 88.21;
+$zenith = 90;
+$gmt_offset = 5.5;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for latitude
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $value, $longitude, $zenith, $gmt_offset) );
+ var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, $value, $longitude, $zenith, $gmt_offset) );
+ var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, $value, $longitude, $zenith, $gmt_offset) );
+
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_sunset() : usage variation ***
+
+--int 0--
+string(5) "17:43"
+float(17.730%d)
+int(1218197630)
+
+--int 1--
+string(5) "17:44"
+float(17.7496%d)
+int(1218197698)
+
+--int 12345--
+bool(false)
+bool(false)
+bool(false)
+
+--int -12345--
+string(5) "17:35"
+float(17.598%d)
+int(1218197155)
+
+--empty array--
+
+Warning: date_sunset() expects parameter 3 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 3 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 3 to be double, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: date_sunset() expects parameter 3 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 3 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 3 to be double, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: date_sunset() expects parameter 3 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 3 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 3 to be double, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: date_sunset() expects parameter 3 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 3 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 3 to be double, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+string(5) "17:43"
+float(17.730%d)
+int(1218197630)
+
+--lowercase null--
+string(5) "17:43"
+float(17.730%d)
+int(1218197630)
+
+--lowercase true--
+string(5) "17:44"
+float(17.7496%d)
+int(1218197698)
+
+--lowercase false--
+string(5) "17:43"
+float(17.730%d)
+int(1218197630)
+
+--uppercase TRUE--
+string(5) "17:44"
+float(17.7496%d)
+int(1218197698)
+
+--uppercase FALSE--
+string(5) "17:43"
+float(17.730%d)
+int(1218197630)
+
+--empty string DQ--
+
+Warning: date_sunset() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: date_sunset() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+--string DQ--
+
+Warning: date_sunset() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+--string SQ--
+
+Warning: date_sunset() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+--mixed case string--
+
+Warning: date_sunset() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+--heredoc--
+
+Warning: date_sunset() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: date_sunset() expects parameter 3 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 3 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 3 to be double, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: date_sunset() expects parameter 3 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 3 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 3 to be double, object given in %s on line %d
+bool(false)
+
+--undefined var--
+string(5) "17:43"
+float(17.730%d)
+int(1218197630)
+
+--unset var--
+string(5) "17:43"
+float(17.730%d)
+int(1218197630)
+===DONE===
diff --git a/ext/date/tests/date_sunset_variation4.phpt b/ext/date/tests/date_sunset_variation4.phpt
new file mode 100644
index 000000000..7840f8f8f
--- /dev/null
+++ b/ext/date/tests/date_sunset_variation4.phpt
@@ -0,0 +1,296 @@
+--TEST--
+Test date_sunset() function : usage variation - Passing unexpected values to fourth argument longitude.
+--FILE--
+<?php
+/* Prototype : mixed date_sunset(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
+ * Description: Returns time of sunset for a given day and location
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing date_sunset() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+date_default_timezone_set("Asia/Calcutta");
+$time = mktime(8, 8, 8, 8, 8, 2008);
+$latitude = 22.34;
+$zenith = 90;
+$gmt_offset = 5.5;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for longitude
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $latitude, $value, $zenith, $gmt_offset) );
+ var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, $latitude, $value, $zenith, $gmt_offset) );
+ var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $value, $zenith, $gmt_offset) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_sunset() : usage variation ***
+
+--int 0--
+string(5) "00:03"
+float(0.059%d)
+int(1218220414)
+
+--int 1--
+string(5) "23:59"
+float(23.992%d)
+int(1218220174)
+
+--int 12345--
+string(5) "17:15"
+float(17.259%d)
+int(1218195932)
+
+--int -12345--
+string(5) "12:18"
+float(12.316%d)
+int(1218178138)
+
+--empty array--
+
+Warning: date_sunset() expects parameter 4 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 4 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 4 to be double, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: date_sunset() expects parameter 4 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 4 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 4 to be double, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: date_sunset() expects parameter 4 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 4 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 4 to be double, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: date_sunset() expects parameter 4 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 4 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 4 to be double, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+string(5) "00:03"
+float(0.059%d)
+int(1218220414)
+
+--lowercase null--
+string(5) "00:03"
+float(0.059%d)
+int(1218220414)
+
+--lowercase true--
+string(5) "23:59"
+float(23.992%d)
+int(1218220174)
+
+--lowercase false--
+string(5) "00:03"
+float(0.059%d)
+int(1218220414)
+
+--uppercase TRUE--
+string(5) "23:59"
+float(23.992%d)
+int(1218220174)
+
+--uppercase FALSE--
+string(5) "00:03"
+float(0.059%d)
+int(1218220414)
+
+--empty string DQ--
+
+Warning: date_sunset() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: date_sunset() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+--string DQ--
+
+Warning: date_sunset() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+--string SQ--
+
+Warning: date_sunset() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+--mixed case string--
+
+Warning: date_sunset() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+--heredoc--
+
+Warning: date_sunset() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: date_sunset() expects parameter 4 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 4 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 4 to be double, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: date_sunset() expects parameter 4 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 4 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 4 to be double, object given in %s on line %d
+bool(false)
+
+--undefined var--
+string(5) "00:03"
+float(0.059%d)
+int(1218220414)
+
+--unset var--
+string(5) "00:03"
+float(0.059%d)
+int(1218220414)
+===DONE===
diff --git a/ext/date/tests/date_sunset_variation5.phpt b/ext/date/tests/date_sunset_variation5.phpt
new file mode 100644
index 000000000..26bf4ccc9
--- /dev/null
+++ b/ext/date/tests/date_sunset_variation5.phpt
@@ -0,0 +1,296 @@
+--TEST--
+Test date_sunset() function : usage variation - Passing unexpected values to fifth argument zenith.
+--FILE--
+<?php
+/* Prototype : mixed date_sunset(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
+ * Description: Returns time of sunset for a given day and location
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing date_sunset() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+date_default_timezone_set("Asia/Calcutta");
+$time = mktime(8, 8, 8, 8, 8, 2008);
+$longitude = 88.21;
+$latitude = 22.34;
+$gmt_offset = 5.5;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for zenith
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $value, $gmt_offset) );
+ var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $value, $gmt_offset) );
+ var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $value, $gmt_offset) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_sunset() : usage variation ***
+
+--int 0--
+bool(false)
+bool(false)
+bool(false)
+
+--int 1--
+bool(false)
+bool(false)
+bool(false)
+
+--int 12345--
+string(5) "19:19"
+float(19.319%d)
+int(1218203349)
+
+--int -12345--
+bool(false)
+bool(false)
+bool(false)
+
+--empty array--
+
+Warning: date_sunset() expects parameter 5 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 5 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 5 to be double, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: date_sunset() expects parameter 5 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 5 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 5 to be double, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: date_sunset() expects parameter 5 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 5 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 5 to be double, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: date_sunset() expects parameter 5 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 5 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 5 to be double, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+bool(false)
+bool(false)
+bool(false)
+
+--lowercase null--
+bool(false)
+bool(false)
+bool(false)
+
+--lowercase true--
+bool(false)
+bool(false)
+bool(false)
+
+--lowercase false--
+bool(false)
+bool(false)
+bool(false)
+
+--uppercase TRUE--
+bool(false)
+bool(false)
+bool(false)
+
+--uppercase FALSE--
+bool(false)
+bool(false)
+bool(false)
+
+--empty string DQ--
+
+Warning: date_sunset() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: date_sunset() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+--string DQ--
+
+Warning: date_sunset() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+--string SQ--
+
+Warning: date_sunset() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+--mixed case string--
+
+Warning: date_sunset() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+--heredoc--
+
+Warning: date_sunset() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: date_sunset() expects parameter 5 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 5 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 5 to be double, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: date_sunset() expects parameter 5 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 5 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 5 to be double, object given in %s on line %d
+bool(false)
+
+--undefined var--
+bool(false)
+bool(false)
+bool(false)
+
+--unset var--
+bool(false)
+bool(false)
+bool(false)
+===DONE===
diff --git a/ext/date/tests/date_sunset_variation6.phpt b/ext/date/tests/date_sunset_variation6.phpt
new file mode 100644
index 000000000..a434de871
--- /dev/null
+++ b/ext/date/tests/date_sunset_variation6.phpt
@@ -0,0 +1,296 @@
+--TEST--
+Test date_sunset() function : usage variation - Passing unexpected values to sixth argument gmt_offset.
+--FILE--
+<?php
+/* Prototype : mixed date_sunset(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
+ * Description: Returns time of sunset for a given day and location
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing date_sunset() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+date_default_timezone_set("Asia/Calcutta");
+$time = mktime(8, 8, 8, 8, 8, 2008);
+$longitude = 88.21;
+$latitude = 22.34;
+$zenith = 90;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for gmt_offset
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $value) );
+ var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $zenith, $value) );
+ var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $zenith, $value) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_sunset() : usage variation ***
+
+--int 0--
+string(5) "12:40"
+float(12.681%d)
+int(1218199253)
+
+--int 1--
+string(5) "13:40"
+float(13.681%d)
+int(1218199253)
+
+--int 12345--
+string(5) "21:40"
+float(21.681%d)
+int(1218199253)
+
+--int -12345--
+string(5) "19:40"
+float(19.681%d)
+int(1218199253)
+
+--empty array--
+
+Warning: date_sunset() expects parameter 6 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 6 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 6 to be double, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: date_sunset() expects parameter 6 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 6 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 6 to be double, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: date_sunset() expects parameter 6 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 6 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 6 to be double, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: date_sunset() expects parameter 6 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 6 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 6 to be double, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+string(5) "12:40"
+float(12.681%d)
+int(1218199253)
+
+--lowercase null--
+string(5) "12:40"
+float(12.681%d)
+int(1218199253)
+
+--lowercase true--
+string(5) "13:40"
+float(13.681%d)
+int(1218199253)
+
+--lowercase false--
+string(5) "12:40"
+float(12.681%d)
+int(1218199253)
+
+--uppercase TRUE--
+string(5) "13:40"
+float(13.681%d)
+int(1218199253)
+
+--uppercase FALSE--
+string(5) "12:40"
+float(12.681%d)
+int(1218199253)
+
+--empty string DQ--
+
+Warning: date_sunset() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: date_sunset() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+--string DQ--
+
+Warning: date_sunset() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+--string SQ--
+
+Warning: date_sunset() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+--mixed case string--
+
+Warning: date_sunset() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+--heredoc--
+
+Warning: date_sunset() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: date_sunset() expects parameter 6 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 6 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 6 to be double, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: date_sunset() expects parameter 6 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 6 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 6 to be double, object given in %s on line %d
+bool(false)
+
+--undefined var--
+string(5) "12:40"
+float(12.681%d)
+int(1218199253)
+
+--unset var--
+string(5) "12:40"
+float(12.681%d)
+int(1218199253)
+===DONE===
diff --git a/ext/date/tests/date_sunset_variation7.phpt b/ext/date/tests/date_sunset_variation7.phpt
new file mode 100644
index 000000000..0c64d969e
--- /dev/null
+++ b/ext/date/tests/date_sunset_variation7.phpt
@@ -0,0 +1,75 @@
+--TEST--
+Test date_sunset() function : usage variation - Checking sunrise for consecutive days in specific timezone
+--FILE--
+<?php
+/* Prototype : mixed date_sunset(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
+ * Description: Returns time of sunrise for a given day and location
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing date_sunset() : usage variation ***\n";
+
+//Timezones with required data for date_sunrise
+$inputs = array (
+ //Timezone with Latitude, Longitude and GMT offset
+ "Pacific/Samoa" => array ("Latitude" => -14.24, "Longitude" => -170.72, "GMT" => -11),
+ "US/Alaska" => array ("Latitude" => 61, "Longitude" => -150 , "GMT" => -9),
+ "America/Chicago" => array ("Latitude" => 41.85, "Longitude" => -87.65 , "GMT" => -5),
+ "America/Montevideo" => array ("Latitude" => -34.88, "Longitude" => -56.18 , "GMT" => -3),
+ "Africa/Casablanca" => array ("Latitude" => 33.65, "Longitude" => "-7.58", "GMT" => 0),
+ "Europe/Moscow" => array ("Latitude" => 55.75, "Longitude" => 37.58, "GMT" => 4),
+ "Asia/Hong_Kong" => array ("Latitude" => 22.28, "Longitude" => 114.15 , "GMT" => 8),
+ "Australia/Brisbane" => array ("Latitude" => -27.46, "Longitude" => 153.2 , "GMT" => 10),
+ "Pacific/Wallis" => array ("Latitude" => -13.3, "Longitude" => -176.16, "GMT" => 12),
+);
+
+foreach($inputs as $timezone => $value) {
+ echo "\n--$timezone--\n";
+ date_default_timezone_set($timezone);
+ $time = mktime(8, 8, 8, 8, 11, 2008);
+ var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $value["Latitude"], $value["Longitude"], 90, $value["GMT"] ));
+ $time = mktime(8, 8, 8, 8, 12, 2008);
+ var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $value["Latitude"], $value["Longitude"], 90, $value["GMT"]) );
+}
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_sunset() : usage variation ***
+
+--Pacific/Samoa--
+string(5) "18:13"
+string(5) "18:13"
+
+--US/Alaska--
+string(5) "21:00"
+string(5) "20:57"
+
+--America/Chicago--
+string(5) "19:51"
+string(5) "19:50"
+
+--America/Montevideo--
+string(5) "18:08"
+string(5) "18:09"
+
+--Africa/Casablanca--
+string(5) "19:17"
+string(5) "19:16"
+
+--Europe/Moscow--
+string(5) "21:09"
+string(5) "21:07"
+
+--Asia/Hong_Kong--
+string(5) "18:55"
+string(5) "18:54"
+
+--Australia/Brisbane--
+string(5) "17:21"
+string(5) "17:21"
+
+--Pacific/Wallis--
+string(5) "17:36"
+string(5) "17:36"
+===DONE===
diff --git a/ext/date/tests/date_sunset_variation8.phpt b/ext/date/tests/date_sunset_variation8.phpt
new file mode 100644
index 000000000..9114e3bfa
--- /dev/null
+++ b/ext/date/tests/date_sunset_variation8.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test date_sunset() function : usage variation - Checking with North and South poles when Sun is up and down all day
+--FILE--
+<?php
+/* Prototype : mixed date_sunset(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
+ * Description: Returns time of sunrise for a given day and location
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing date_sunset() : usage variation ***\n";
+
+// GMT is zero for the timezone
+date_default_timezone_set("Africa/Casablanca");
+$time_date = array (
+
+ //Date at which Sun is up all day at North Pole
+ "12 Aug 2008" => mktime(8, 8, 8, 8, 12, 2008),
+
+ //Date at which Sun is up all day at South Pole
+ "12 Nov 2008" => mktime(8, 8, 8, 11, 12, 2008),
+);
+
+//Iterate over different date and time
+foreach( $time_date as $date => $time ){
+ echo "\n--$date--\n";
+ var_dump( date_sunset($time, SUNFUNCS_RET_STRING, 90, 0 ) );
+ var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, 90, 0 ) );
+ var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, 90, 0 ) );
+ var_dump( date_sunset($time, SUNFUNCS_RET_STRING, -90, 0 ) );
+ var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, -90, 0 ) );
+ var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, -90, 0 ) );
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_sunset() : usage variation ***
+
+--12 Aug 2008--
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+--12 Nov 2008--
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+===DONE===
diff --git a/ext/date/tests/date_sunset_variation9.phpt b/ext/date/tests/date_sunset_variation9.phpt
new file mode 100644
index 000000000..59a4b584a
--- /dev/null
+++ b/ext/date/tests/date_sunset_variation9.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test date_sunset() function : usage variation - Passing high positive and negative float values to time argument.
+--FILE--
+<?php
+/* Prototype : mixed date_sunset(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
+ * Description: Returns time of sunset for a given day and location
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing date_sunset() : usage variation ***\n";
+
+// GMT is zero for the timezone
+date_default_timezone_set("Asia/Calcutta");
+//Initialise the variables
+$latitude = 38.4;
+$longitude = -9;
+$zenith = 90;
+$gmt_offset = 1;
+
+echo "\n-- Testing date_sunset() function by passing float 12.3456789000e10 value to time --\n";
+$time = 12.3456789000e10;
+var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $gmt_offset) );
+var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $zenith, $gmt_offset) );
+var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $zenith, $gmt_offset) );
+
+echo "\n-- Testing date_sunset() function by passing float -12.3456789000e10 value to time --\n";
+$time = -12.3456789000e10;
+var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $gmt_offset) );
+var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $zenith, $gmt_offset) );
+var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $zenith, $gmt_offset) );
+
+?>
+===DONE===
+--EXPECTREGEX--
+\*\*\* Testing date_sunset\(\) : usage variation \*\*\*
+
+-- Testing date_sunset\(\) function by passing float 12.3456789000e10 value to time --
+string\(5\) "(19:49|19:28)"
+float\((19.830[0-9]*|19.830[0-9]*|19.480[0-9]*)\)
+int\((-1097212211|123456853728)\)
+
+-- Testing date_sunset\(\) function by passing float -12.3456789000e10 value to time --
+string\(5\) "(19:03|18:12|18:48)"
+float\((19.056[0-9]*|18.213[0-9]*|18.808[0-9]*)\)
+int\((1097345002|-2147410031|-123456723090)\)
+===DONE===
diff --git a/ext/date/tests/getdate_basic.phpt b/ext/date/tests/getdate_basic.phpt
new file mode 100644
index 000000000..5d6cc815d
--- /dev/null
+++ b/ext/date/tests/getdate_basic.phpt
@@ -0,0 +1,76 @@
+--TEST--
+Test getdate() function : basic functionality
+--FILE--
+<?php
+/* Prototype : array getdate([int timestamp])
+ * Description: Get date/time information
+ * Source code: ext/date/php_date.c
+ */
+
+echo "*** Testing getdate() : basic functionality ***\n";
+
+//Set the default time zone
+date_default_timezone_set("Asia/Calcutta");
+
+// Initialise all required variables
+$timestamp = 10;
+
+// Calling getdate() with all possible arguments
+var_dump( getdate($timestamp) );
+
+// Calling getdate() with mandatory arguments
+var_dump( getdate() );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing getdate() : basic functionality ***
+array(11) {
+ ["seconds"]=>
+ int(10)
+ ["minutes"]=>
+ int(30)
+ ["hours"]=>
+ int(5)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(10)
+}
+array(11) {
+ ["seconds"]=>
+ int(%d)
+ ["minutes"]=>
+ int(%d)
+ ["hours"]=>
+ int(%d)
+ ["mday"]=>
+ int(%d)
+ ["wday"]=>
+ int(%d)
+ ["mon"]=>
+ int(%d)
+ ["year"]=>
+ int(%d)
+ ["yday"]=>
+ int(%d)
+ ["weekday"]=>
+ string(%d) %s
+ ["month"]=>
+ string(%d) %s
+ [0]=>
+ int(%d)
+}
+===DONE===
diff --git a/ext/date/tests/getdate_error.phpt b/ext/date/tests/getdate_error.phpt
new file mode 100644
index 000000000..149d06695
--- /dev/null
+++ b/ext/date/tests/getdate_error.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test getdate() function : error conditions
+--FILE--
+<?php
+/* Prototype : array getdate([int timestamp])
+ * Description: Get date/time information
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing getdate() : error conditions ***\n";
+
+//Set the default time zone
+date_default_timezone_set("America/Chicago");
+
+//Test getdate with one more than the expected number of arguments
+echo "\n-- Testing getdate() function with more than expected no. of arguments --\n";
+$timestamp = 10;
+$extra_arg = 10;
+var_dump( getdate($timestamp, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing getdate() : error conditions ***
+
+-- Testing getdate() function with more than expected no. of arguments --
+
+Warning: getdate() expects at most 1 parameter, 2 given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/getdate_variation1.phpt b/ext/date/tests/getdate_variation1.phpt
new file mode 100644
index 000000000..4935dfe8e
--- /dev/null
+++ b/ext/date/tests/getdate_variation1.phpt
@@ -0,0 +1,444 @@
+--TEST--
+Test getdate() function : usage variation - Passing unexpected values to first argument timestamp.
+--FILE--
+<?php
+/* Prototype : array getdate([int timestamp])
+ * Description: Get date/time information
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing getdate() : usage variation ***\n";
+
+//Set the default time zone
+date_default_timezone_set("Asia/Calcutta");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( getdate($value) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+
+*** Testing getdate() : usage variation ***
+
+--float 10.5--
+array(11) {
+ ["seconds"]=>
+ int(10)
+ ["minutes"]=>
+ int(30)
+ ["hours"]=>
+ int(5)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(10)
+}
+
+--float -10.5--
+array(11) {
+ ["seconds"]=>
+ int(50)
+ ["minutes"]=>
+ int(29)
+ ["hours"]=>
+ int(5)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(-10)
+}
+
+--float .5--
+array(11) {
+ ["seconds"]=>
+ int(0)
+ ["minutes"]=>
+ int(30)
+ ["hours"]=>
+ int(5)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(0)
+}
+
+--empty array--
+
+Warning: getdate() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: getdate() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: getdate() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: getdate() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+array(11) {
+ ["seconds"]=>
+ int(0)
+ ["minutes"]=>
+ int(30)
+ ["hours"]=>
+ int(5)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(0)
+}
+
+--lowercase null--
+array(11) {
+ ["seconds"]=>
+ int(0)
+ ["minutes"]=>
+ int(30)
+ ["hours"]=>
+ int(5)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(0)
+}
+
+--lowercase true--
+array(11) {
+ ["seconds"]=>
+ int(1)
+ ["minutes"]=>
+ int(30)
+ ["hours"]=>
+ int(5)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(1)
+}
+
+--lowercase false--
+array(11) {
+ ["seconds"]=>
+ int(0)
+ ["minutes"]=>
+ int(30)
+ ["hours"]=>
+ int(5)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(0)
+}
+
+--uppercase TRUE--
+array(11) {
+ ["seconds"]=>
+ int(1)
+ ["minutes"]=>
+ int(30)
+ ["hours"]=>
+ int(5)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(1)
+}
+
+--uppercase FALSE--
+array(11) {
+ ["seconds"]=>
+ int(0)
+ ["minutes"]=>
+ int(30)
+ ["hours"]=>
+ int(5)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(0)
+}
+
+--empty string DQ--
+
+Warning: getdate() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: getdate() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--string DQ--
+
+Warning: getdate() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--string SQ--
+
+Warning: getdate() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--mixed case string--
+
+Warning: getdate() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--heredoc--
+
+Warning: getdate() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: getdate() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: getdate() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+
+--undefined var--
+array(11) {
+ ["seconds"]=>
+ int(0)
+ ["minutes"]=>
+ int(30)
+ ["hours"]=>
+ int(5)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(0)
+}
+
+--unset var--
+array(11) {
+ ["seconds"]=>
+ int(0)
+ ["minutes"]=>
+ int(30)
+ ["hours"]=>
+ int(5)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(0)
+}
+===DONE===
diff --git a/ext/date/tests/getdate_variation2.phpt b/ext/date/tests/getdate_variation2.phpt
new file mode 100644
index 000000000..f987d2134
--- /dev/null
+++ b/ext/date/tests/getdate_variation2.phpt
@@ -0,0 +1,114 @@
+--TEST--
+Test getdate() function : usage variation - Passing octal timestamp values
+--FILE--
+<?php
+/* Prototype : array getdate([int timestamp])
+ * Description: Get date/time information
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing getdate() : usage variation ***\n";
+
+//Set the default time zone
+date_default_timezone_set("Asia/Calcutta");
+
+//array of values to iterate over
+$inputs = array(
+
+ //octal values
+ 'octal 05' => 05,
+ 'octal 010' => 010,
+ 'octal -010' => -010,
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( getdate($value) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing getdate() : usage variation ***
+
+--octal 05--
+array(11) {
+ ["seconds"]=>
+ int(5)
+ ["minutes"]=>
+ int(30)
+ ["hours"]=>
+ int(5)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(5)
+}
+
+--octal 010--
+array(11) {
+ ["seconds"]=>
+ int(8)
+ ["minutes"]=>
+ int(30)
+ ["hours"]=>
+ int(5)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(8)
+}
+
+--octal -010--
+array(11) {
+ ["seconds"]=>
+ int(52)
+ ["minutes"]=>
+ int(29)
+ ["hours"]=>
+ int(5)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(-8)
+}
+===DONE===
diff --git a/ext/date/tests/getdate_variation3.phpt b/ext/date/tests/getdate_variation3.phpt
new file mode 100644
index 000000000..f7d686320
--- /dev/null
+++ b/ext/date/tests/getdate_variation3.phpt
@@ -0,0 +1,114 @@
+--TEST--
+Test getdate() function : usage variation - Passing hexadcimal timestamp values
+--FILE--
+<?php
+/* Prototype : array getdate([int timestamp])
+ * Description: Get date/time information
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing getdate() : usage variation ***\n";
+
+//Set the default time zone
+date_default_timezone_set("Asia/Calcutta");
+
+//array of values to iterate over
+$inputs = array(
+
+ //octal values
+ 'hexadcimal 0x5' => 0x5,
+ 'hexadcimal 0xCAFE' => 0xCAFE,
+ 'octal -0xCAFE' => -0xCAFE,
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( getdate($value) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing getdate() : usage variation ***
+
+--hexadcimal 0x5--
+array(11) {
+ ["seconds"]=>
+ int(5)
+ ["minutes"]=>
+ int(30)
+ ["hours"]=>
+ int(5)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(5)
+}
+
+--hexadcimal 0xCAFE--
+array(11) {
+ ["seconds"]=>
+ int(6)
+ ["minutes"]=>
+ int(56)
+ ["hours"]=>
+ int(19)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(51966)
+}
+
+--octal -0xCAFE--
+array(11) {
+ ["seconds"]=>
+ int(54)
+ ["minutes"]=>
+ int(3)
+ ["hours"]=>
+ int(15)
+ ["mday"]=>
+ int(31)
+ ["wday"]=>
+ int(3)
+ ["mon"]=>
+ int(12)
+ ["year"]=>
+ int(1969)
+ ["yday"]=>
+ int(364)
+ ["weekday"]=>
+ string(9) "Wednesday"
+ ["month"]=>
+ string(8) "December"
+ [0]=>
+ int(-51966)
+}
+===DONE===
diff --git a/ext/date/tests/getdate_variation4.phpt b/ext/date/tests/getdate_variation4.phpt
new file mode 100644
index 000000000..92719ac65
--- /dev/null
+++ b/ext/date/tests/getdate_variation4.phpt
@@ -0,0 +1,141 @@
+--TEST--
+Test getdate() function : usage variation - Verifyig by supplying year-wise sample time stamps since Unix epoch time
+--FILE--
+<?php
+/* Prototype : array getdate([int timestamp])
+ * Description: Get date/time information
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing getdate() : usage variation ***\n";
+
+//Set the default time zone
+date_default_timezone_set("Asia/Calcutta");
+
+//array of values to iterate over
+$inputs = array(
+
+ //Year wise time stamps
+ '01 Jan 1970' => 0,
+ '01 Jan 1971' => 31536000,
+ '01 Jan 1972' => 63072000,
+ '01 Jan 1973' => 94694400,
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( getdate($value) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing getdate() : usage variation ***
+
+--01 Jan 1970--
+array(11) {
+ ["seconds"]=>
+ int(0)
+ ["minutes"]=>
+ int(30)
+ ["hours"]=>
+ int(5)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(0)
+}
+
+--01 Jan 1971--
+array(11) {
+ ["seconds"]=>
+ int(0)
+ ["minutes"]=>
+ int(30)
+ ["hours"]=>
+ int(5)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(5)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1971)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(6) "Friday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(31536000)
+}
+
+--01 Jan 1972--
+array(11) {
+ ["seconds"]=>
+ int(0)
+ ["minutes"]=>
+ int(30)
+ ["hours"]=>
+ int(5)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(6)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1972)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Saturday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(63072000)
+}
+
+--01 Jan 1973--
+array(11) {
+ ["seconds"]=>
+ int(0)
+ ["minutes"]=>
+ int(30)
+ ["hours"]=>
+ int(5)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(1)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1973)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(6) "Monday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(94694400)
+}
+===DONE===
diff --git a/ext/date/tests/getdate_variation5.phpt b/ext/date/tests/getdate_variation5.phpt
new file mode 100644
index 000000000..e4524a865
--- /dev/null
+++ b/ext/date/tests/getdate_variation5.phpt
@@ -0,0 +1,223 @@
+--TEST--
+Test getdate() function : usage variation - Verifyig with different timezones on Unix epoch timestamp
+--FILE--
+<?php
+/* Prototype : array getdate([int timestamp])
+ * Description: Get date/time information
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing getdate() : usage variation ***\n";
+
+//Timezones with required data for date_sunrise
+$inputs = array (
+ //GMT-11
+ "Pacific/Samoa",
+ //GMT-9
+ "US/Alaska",
+ //GMT-0
+ "Africa/Casablanca",
+ //GMT+4
+ "Europe/Moscow",
+ //GMT+8
+ "Asia/Hong_Kong",
+ //GMT+10
+ "Australia/Brisbane",
+ //GMT+12
+ "Pacific/Wallis",
+);
+
+// loop through each element of the array for timestamp
+foreach($inputs as $timezone) {
+ echo "\n--$timezone--\n";
+ date_default_timezone_set($timezone);
+ var_dump( getdate(0) );
+};
+?>
+===DONE===
+--EXPECTF--
+*** Testing getdate() : usage variation ***
+
+--Pacific/Samoa--
+array(11) {
+ ["seconds"]=>
+ int(0)
+ ["minutes"]=>
+ int(0)
+ ["hours"]=>
+ int(13)
+ ["mday"]=>
+ int(31)
+ ["wday"]=>
+ int(3)
+ ["mon"]=>
+ int(12)
+ ["year"]=>
+ int(1969)
+ ["yday"]=>
+ int(364)
+ ["weekday"]=>
+ string(9) "Wednesday"
+ ["month"]=>
+ string(8) "December"
+ [0]=>
+ int(0)
+}
+
+--US/Alaska--
+array(11) {
+ ["seconds"]=>
+ int(0)
+ ["minutes"]=>
+ int(0)
+ ["hours"]=>
+ int(14)
+ ["mday"]=>
+ int(31)
+ ["wday"]=>
+ int(3)
+ ["mon"]=>
+ int(12)
+ ["year"]=>
+ int(1969)
+ ["yday"]=>
+ int(364)
+ ["weekday"]=>
+ string(9) "Wednesday"
+ ["month"]=>
+ string(8) "December"
+ [0]=>
+ int(0)
+}
+
+--Africa/Casablanca--
+array(11) {
+ ["seconds"]=>
+ int(0)
+ ["minutes"]=>
+ int(0)
+ ["hours"]=>
+ int(0)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(0)
+}
+
+--Europe/Moscow--
+array(11) {
+ ["seconds"]=>
+ int(0)
+ ["minutes"]=>
+ int(0)
+ ["hours"]=>
+ int(3)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(0)
+}
+
+--Asia/Hong_Kong--
+array(11) {
+ ["seconds"]=>
+ int(0)
+ ["minutes"]=>
+ int(0)
+ ["hours"]=>
+ int(8)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(0)
+}
+
+--Australia/Brisbane--
+array(11) {
+ ["seconds"]=>
+ int(0)
+ ["minutes"]=>
+ int(0)
+ ["hours"]=>
+ int(10)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(0)
+}
+
+--Pacific/Wallis--
+array(11) {
+ ["seconds"]=>
+ int(0)
+ ["minutes"]=>
+ int(0)
+ ["hours"]=>
+ int(12)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(0)
+}
+===DONE===
diff --git a/ext/date/tests/getdate_variation6.phpt b/ext/date/tests/getdate_variation6.phpt
new file mode 100644
index 000000000..5c03a3bb7
--- /dev/null
+++ b/ext/date/tests/getdate_variation6.phpt
@@ -0,0 +1,109 @@
+--TEST--
+Test getdate() function : usage variation - Passing strings containing numbers
+--FILE--
+<?php
+/* Prototype : array getdate([int timestamp])
+ * Description: Get date/time information
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing getdate() : usage variation ***\n";
+
+date_default_timezone_set("Asia/Calcutta");
+
+//Timezones with required data for date_sunrise
+$inputs = array (
+ 'String 0' => '0',
+ 'String 10.5' => "10.5",
+ 'String -10.5' => '-10.5',
+);
+
+// loop through each element of the array for timestamp
+foreach($inputs as $key => $value) {
+ echo "\n--$key--\n";
+ var_dump( getdate($value) );
+};
+?>
+===DONE===
+--EXPECTF--
+*** Testing getdate() : usage variation ***
+
+--String 0--
+array(11) {
+ ["seconds"]=>
+ int(0)
+ ["minutes"]=>
+ int(30)
+ ["hours"]=>
+ int(5)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(0)
+}
+
+--String 10.5--
+array(11) {
+ ["seconds"]=>
+ int(10)
+ ["minutes"]=>
+ int(30)
+ ["hours"]=>
+ int(5)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(10)
+}
+
+--String -10.5--
+array(11) {
+ ["seconds"]=>
+ int(50)
+ ["minutes"]=>
+ int(29)
+ ["hours"]=>
+ int(5)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(-10)
+}
+===DONE===
diff --git a/ext/date/tests/getdate_variation7.phpt b/ext/date/tests/getdate_variation7.phpt
new file mode 100644
index 000000000..5af2dd53f
--- /dev/null
+++ b/ext/date/tests/getdate_variation7.phpt
@@ -0,0 +1,78 @@
+--TEST--
+Test getdate() function : usage variation - Passing high positive and negative float values to timestamp.
+--FILE--
+<?php
+/* Prototype : array getdate([int timestamp])
+ * Description: Get date/time information
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing getdate() : usage variation ***\n";
+date_default_timezone_set("Asia/Calcutta");
+
+echo "\n-- Testing getdate() function by passing float 12.3456789000e10 value to timestamp --\n";
+$timestamp = 12.3456789000e10;
+var_dump( getdate($timestamp) );
+
+echo "\n-- Testing getdate() function by passing float -12.3456789000e10 value to timestamp --\n";
+$timestamp = -12.3456789000e10;
+var_dump( getdate($timestamp) );
+?>
+===DONE===
+--EXPECTREGEX--
+
+\*\*\* Testing getdate\(\) : usage variation \*\*\*
+
+-- Testing getdate\(\) function by passing float 12.3456789000e10 value to timestamp --
+array\(11\) {
+ \["seconds"\]=>
+ int\((36|0)\)
+ \["minutes"\]=>
+ int\((43|0)\)
+ \["hours"\]=>
+ int\((10|6)\)
+ \["mday"\]=>
+ int\((26|11)\)
+ \["wday"\]=>
+ int\((2|6)\)
+ \["mon"\]=>
+ int\(3\)
+ \["year"\]=>
+ int\((1935|5882)\)
+ \["yday"\]=>
+ int\((84|69)\)
+ \["weekday"\]=>
+ string\((7|8)\) "(Tuesday|Saturday)"
+ \["month"\]=>
+ string\(5\) "March"
+ \[0\]=>
+ int\((-1097262584|123456789000)\)
+}
+
+-- Testing getdate\(\) function by passing float -12.3456789000e10 value to timestamp --
+array\(11\) {
+ \["seconds"\]=>
+ int\((44|12|20)\)
+ \["minutes"\]=>
+ int\((39|23)\)
+ \["hours"\]=>
+ int\((0|2|5)\)
+ \["mday"\]=>
+ int\((9|14|23)\)
+ \["wday"\]=>
+ int\((6|-4)\)
+ \["mon"\]=>
+ int\((10|12)\)
+ \["year"\]=>
+ int\((2004|1901|-1943)\)
+ \["yday"\]=>
+ int\((282|347|295)\)
+ \["weekday"\]=>
+ string\((8|7)\) "(Saturday|Unknown)"
+ \["month"\]=>
+ string\((7|8)\) "(October|December)"
+ \[0\]=>
+ int\((1097262584|-2147483648|-123456789000)\)
+}
+===DONE===
diff --git a/ext/date/tests/gettimeofday_basic.phpt b/ext/date/tests/gettimeofday_basic.phpt
new file mode 100644
index 000000000..fe04f015e
--- /dev/null
+++ b/ext/date/tests/gettimeofday_basic.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test gettimeofday() function : basic functionality
+--FILE--
+<?php
+/* Prototype : array gettimeofday([bool get_as_float])
+ * Description: Returns the current time as array
+ * Source code: ext/standard/microtime.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gettimeofday() : basic functionality ***\n";
+
+date_default_timezone_set("Asia/Calcutta");
+
+// Initialise all required variables
+$get_as_float = true;
+
+// Calling gettimeofday() with all possible arguments
+var_dump( gettimeofday($get_as_float) );
+
+// Calling gettimeofday() with mandatory arguments
+var_dump( gettimeofday() );
+
+// Initialise all required variables
+$get_as_float = false;
+
+// Calling gettimeofday() with all possible arguments
+var_dump( gettimeofday($get_as_float) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gettimeofday() : basic functionality ***
+float(%f)
+array(4) {
+ ["sec"]=>
+ int(%d)
+ ["usec"]=>
+ int(%d)
+ ["minuteswest"]=>
+ int(-330)
+ ["dsttime"]=>
+ int(0)
+}
+array(4) {
+ ["sec"]=>
+ int(%d)
+ ["usec"]=>
+ int(%d)
+ ["minuteswest"]=>
+ int(-330)
+ ["dsttime"]=>
+ int(0)
+}
+===DONE===
diff --git a/ext/date/tests/gettimeofday_error.phpt b/ext/date/tests/gettimeofday_error.phpt
new file mode 100644
index 000000000..558a381fe
--- /dev/null
+++ b/ext/date/tests/gettimeofday_error.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test gettimeofday() function : error conditions
+--FILE--
+<?php
+/* Prototype : array gettimeofday([bool get_as_float])
+ * Description: Returns the current time as array
+ * Source code: ext/standard/microtime.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gettimeofday() : error conditions ***\n";
+
+
+//Test gettimeofday with one more than the expected number of arguments
+echo "\n-- Testing gettimeofday() function with more than expected no. of arguments --\n";
+$get_as_float = true;
+$extra_arg = 10;
+var_dump( gettimeofday($get_as_float, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gettimeofday() : error conditions ***
+
+-- Testing gettimeofday() function with more than expected no. of arguments --
+
+Warning: gettimeofday() expects at most 1 parameter, 2 given in %s on line %d
+NULL
+===DONE===
diff --git a/ext/date/tests/gettimeofday_variation1.phpt b/ext/date/tests/gettimeofday_variation1.phpt
new file mode 100644
index 000000000..f494a25b5
--- /dev/null
+++ b/ext/date/tests/gettimeofday_variation1.phpt
@@ -0,0 +1,284 @@
+--TEST--
+Test gettimeofday() function : usage variation - Passing unexpected values to get_as_float argument
+--FILE--
+<?php
+/* Prototype : array gettimeofday([bool get_as_float])
+ * Description: Returns the current time as array
+ * Source code: ext/standard/microtime.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gettimeofday() : usage variation ***\n";
+
+date_default_timezone_set("Asia/Calcutta");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for get_as_float
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gettimeofday($value) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gettimeofday() : usage variation ***
+
+--int 0--
+array(4) {
+ ["sec"]=>
+ int(%d)
+ ["usec"]=>
+ int(%d)
+ ["minuteswest"]=>
+ int(-330)
+ ["dsttime"]=>
+ int(0)
+}
+
+--int 1--
+float(%f)
+
+--int 12345--
+float(%f)
+
+--int -12345--
+float(%f)
+
+--float 10.5--
+float(%f)
+
+--float -10.5--
+float(%f)
+
+--float 12.3456789000e10--
+float(%f)
+
+--float -12.3456789000e10--
+float(%f)
+
+--float .5--
+float(%f)
+
+--empty array--
+
+Warning: gettimeofday() expects parameter 1 to be boolean, array given in %s on line %d
+NULL
+
+--int indexed array--
+
+Warning: gettimeofday() expects parameter 1 to be boolean, array given in %s on line %d
+NULL
+
+--associative array--
+
+Warning: gettimeofday() expects parameter 1 to be boolean, array given in %s on line %d
+NULL
+
+--nested arrays--
+
+Warning: gettimeofday() expects parameter 1 to be boolean, array given in %s on line %d
+NULL
+
+--uppercase NULL--
+array(4) {
+ ["sec"]=>
+ int(%d)
+ ["usec"]=>
+ int(%d)
+ ["minuteswest"]=>
+ int(-330)
+ ["dsttime"]=>
+ int(0)
+}
+
+--lowercase null--
+array(4) {
+ ["sec"]=>
+ int(%d)
+ ["usec"]=>
+ int(%d)
+ ["minuteswest"]=>
+ int(-330)
+ ["dsttime"]=>
+ int(0)
+}
+
+--lowercase true--
+float(%f)
+
+--lowercase false--
+array(4) {
+ ["sec"]=>
+ int(%d)
+ ["usec"]=>
+ int(%d)
+ ["minuteswest"]=>
+ int(-330)
+ ["dsttime"]=>
+ int(0)
+}
+
+--uppercase TRUE--
+float(%f)
+
+--uppercase FALSE--
+array(4) {
+ ["sec"]=>
+ int(%d)
+ ["usec"]=>
+ int(%d)
+ ["minuteswest"]=>
+ int(-330)
+ ["dsttime"]=>
+ int(0)
+}
+
+--empty string DQ--
+array(4) {
+ ["sec"]=>
+ int(%d)
+ ["usec"]=>
+ int(%d)
+ ["minuteswest"]=>
+ int(-330)
+ ["dsttime"]=>
+ int(0)
+}
+
+--empty string SQ--
+array(4) {
+ ["sec"]=>
+ int(%d)
+ ["usec"]=>
+ int(%d)
+ ["minuteswest"]=>
+ int(-330)
+ ["dsttime"]=>
+ int(0)
+}
+
+--string DQ--
+float(%f)
+
+--string SQ--
+float(%f)
+
+--mixed case string--
+float(%f)
+
+--heredoc--
+float(%f)
+
+--instance of classWithToString--
+
+Warning: gettimeofday() expects parameter 1 to be boolean, object given in %s on line %d
+NULL
+
+--instance of classWithoutToString--
+
+Warning: gettimeofday() expects parameter 1 to be boolean, object given in %s on line %d
+NULL
+
+--undefined var--
+array(4) {
+ ["sec"]=>
+ int(%d)
+ ["usec"]=>
+ int(%d)
+ ["minuteswest"]=>
+ int(-330)
+ ["dsttime"]=>
+ int(0)
+}
+
+--unset var--
+array(4) {
+ ["sec"]=>
+ int(%d)
+ ["usec"]=>
+ int(%d)
+ ["minuteswest"]=>
+ int(-330)
+ ["dsttime"]=>
+ int(0)
+}
+===DONE===
diff --git a/ext/date/tests/gmdate_basic.phpt b/ext/date/tests/gmdate_basic.phpt
new file mode 100644
index 000000000..ae036cacb
--- /dev/null
+++ b/ext/date/tests/gmdate_basic.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Test gmdate() function : basic functionality
+--FILE--
+<?php
+/* Prototype : string gmdate(string format [, long timestamp])
+ * Description: Format a GMT date/time
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmdate() : basic functionality ***\n";
+
+// Initialise all required variables
+date_default_timezone_set('UTC');
+$format = DATE_ISO8601;
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+// Calling gmdate() with all possible arguments
+var_dump( gmdate($format, $timestamp) );
+
+// Calling gmdate() with mandatory arguments
+var_dump( gmdate($format) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmdate() : basic functionality ***
+string(24) "2008-08-08T08:08:08+0000"
+string(%d) "%s"
+===DONE===
diff --git a/ext/date/tests/gmdate_error.phpt b/ext/date/tests/gmdate_error.phpt
new file mode 100644
index 000000000..fbee07126
--- /dev/null
+++ b/ext/date/tests/gmdate_error.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test gmdate() function : error conditions
+--FILE--
+<?php
+/* Prototype : string gmdate(string format [, long timestamp])
+ * Description: Format a GMT date/time
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmdate() : error conditions ***\n";
+
+// Initialise all required variables
+date_default_timezone_set('UTC');
+$format = DATE_ISO8601;
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+// Zero arguments
+echo "\n-- Testing gmdate() function with Zero arguments --\n";
+var_dump( gmdate() );
+
+//Test gmdate with one more than the expected number of arguments
+echo "\n-- Testing gmdate() function with more than expected no. of arguments --\n";
+$extra_arg = 10;
+var_dump( gmdate($format, $timestamp, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmdate() : error conditions ***
+
+-- Testing gmdate() function with Zero arguments --
+
+Warning: gmdate() expects at least 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing gmdate() function with more than expected no. of arguments --
+
+Warning: gmdate() expects at most 2 parameters, 3 given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/gmdate_variation1.phpt b/ext/date/tests/gmdate_variation1.phpt
new file mode 100644
index 000000000..f6850ccd2
--- /dev/null
+++ b/ext/date/tests/gmdate_variation1.phpt
@@ -0,0 +1,221 @@
+--TEST--
+Test gmdate() function : usage variation - Passing unexpected values to format argument.
+--FILE--
+<?php
+/* Prototype : string gmdate(string format [, long timestamp])
+ * Description: Format a GMT date/time
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmdate() : usage variation ***\n";
+
+// Initialise all required variables
+date_default_timezone_set('UTC');
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for format
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmdate($value, $timestamp) );
+ var_dump( gmdate($value) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmdate() : usage variation ***
+
+--int 0--
+string(1) "0"
+string(1) "0"
+
+--int 1--
+string(1) "1"
+string(1) "1"
+
+--int 12345--
+string(5) "12345"
+string(5) "12345"
+
+--int -12345--
+string(6) "-12345"
+string(6) "-12345"
+
+--float 10.5--
+string(4) "10.5"
+string(4) "10.5"
+
+--float -10.5--
+string(5) "-10.5"
+string(5) "-10.5"
+
+--float 12.3456789000e10--
+string(12) "123456789000"
+string(12) "123456789000"
+
+--float -12.3456789000e10--
+string(13) "-123456789000"
+string(13) "-123456789000"
+
+--float .5--
+string(3) "0.5"
+string(3) "0.5"
+
+--empty array--
+
+Warning: gmdate() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+Warning: gmdate() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: gmdate() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+Warning: gmdate() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: gmdate() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+Warning: gmdate() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: gmdate() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+Warning: gmdate() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+string(0) ""
+string(0) ""
+
+--lowercase null--
+string(0) ""
+string(0) ""
+
+--lowercase true--
+string(1) "1"
+string(1) "1"
+
+--lowercase false--
+string(0) ""
+string(0) ""
+
+--uppercase TRUE--
+string(1) "1"
+string(1) "1"
+
+--uppercase FALSE--
+string(0) ""
+string(0) ""
+
+--empty string DQ--
+string(0) ""
+string(0) ""
+
+--empty string SQ--
+string(0) ""
+string(0) ""
+
+--instance of classWithToString--
+string(53) "CFridayam0808 AM 2008b8UTC2008-08-08T08:08:08+00:0031"
+string(%d) "%s"
+
+--instance of classWithoutToString--
+
+Warning: gmdate() expects parameter 1 to be string, object given in %s on line %d
+bool(false)
+
+Warning: gmdate() expects parameter 1 to be string, object given in %s on line %d
+bool(false)
+
+--undefined var--
+string(0) ""
+string(0) ""
+
+--unset var--
+string(0) ""
+string(0) ""
+===DONE===
diff --git a/ext/date/tests/gmdate_variation10.phpt b/ext/date/tests/gmdate_variation10.phpt
new file mode 100644
index 000000000..d5298368d
--- /dev/null
+++ b/ext/date/tests/gmdate_variation10.phpt
@@ -0,0 +1,69 @@
+--TEST--
+Test gmdate() function : usage variation - Passing Timezone format options to format argument.
+--FILE--
+<?php
+/* Prototype : string gmdate(string format [, long timestamp])
+ * Description: Format a GMT date/time
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmdate() : usage variation ***\n";
+
+// Initialise all required variables
+date_default_timezone_set('Asia/Calcutta');
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+echo "\n-- Testing gmdate() function with Timezone identifier format --\n";
+var_dump( gmdate('e') );
+var_dump( gmdate('e', $timestamp) );
+
+echo "\n-- Testing gmdate() function with checking whether date is in daylight saving time format --\n";
+var_dump( gmdate('I') );
+var_dump( gmdate('I', $timestamp) );
+
+echo "\n-- Testing gmdate() function with difference to GMT in hours format --\n";
+var_dump( gmdate('O') );
+var_dump( gmdate('O', $timestamp) );
+
+echo "\n-- Testing gmdate() function with Difference to GMT in hours using colon as separator format --\n";
+var_dump( gmdate('P') );
+var_dump( gmdate('P', $timestamp) );
+
+echo "\n-- Testing gmdate() function with timezone abbreviation format --\n";
+var_dump( gmdate('T') );
+var_dump( gmdate('T', $timestamp) );
+
+echo "\n-- Testing gmdate() function with timezone offset format --\n";
+var_dump( gmdate('T') );
+var_dump( gmdate('T', $timestamp) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmdate() : usage variation ***
+
+-- Testing gmdate() function with Timezone identifier format --
+string(3) "UTC"
+string(3) "UTC"
+
+-- Testing gmdate() function with checking whether date is in daylight saving time format --
+string(1) "%d"
+string(1) "%d"
+
+-- Testing gmdate() function with difference to GMT in hours format --
+string(5) "+0000"
+string(5) "+0000"
+
+-- Testing gmdate() function with Difference to GMT in hours using colon as separator format --
+string(6) "+00:00"
+string(6) "+00:00"
+
+-- Testing gmdate() function with timezone abbreviation format --
+string(3) "GMT"
+string(3) "GMT"
+
+-- Testing gmdate() function with timezone offset format --
+string(3) "GMT"
+string(3) "GMT"
+===DONE===
diff --git a/ext/date/tests/gmdate_variation11.phpt b/ext/date/tests/gmdate_variation11.phpt
new file mode 100644
index 000000000..a9520907c
--- /dev/null
+++ b/ext/date/tests/gmdate_variation11.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test gmdate() function : usage variation - Passing Full Date/Time format options to format argument.
+--FILE--
+<?php
+/* Prototype : string gmdate(string format [, long timestamp])
+ * Description: Format a GMT date/time
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmdate() : usage variation ***\n";
+
+// Initialise all required variables
+date_default_timezone_set('UTC');
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+echo "\n-- Testing gmdate() function with ISO 8601 date format --\n";
+var_dump( gmdate('c') );
+var_dump( gmdate('c', $timestamp) );
+
+echo "\n-- Testing gmdate() function with RFC 2822 date format --\n";
+var_dump( gmdate('r') );
+var_dump( gmdate('r', $timestamp) );
+
+echo "\n-- Testing gmdate() function with seconds since Unix Epoch format --\n";
+var_dump( gmdate('U') );
+var_dump( gmdate('U', $timestamp) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmdate() : usage variation ***
+
+-- Testing gmdate() function with ISO 8601 date format --
+string(%d) "%s"
+string(25) "2008-08-08T08:08:08+00:00"
+
+-- Testing gmdate() function with RFC 2822 date format --
+string(%d) "%s"
+string(31) "Fri, 08 Aug 2008 08:08:08 +0000"
+
+-- Testing gmdate() function with seconds since Unix Epoch format --
+string(%d) "%d"
+string(10) "1218182888"
+===DONE===
diff --git a/ext/date/tests/gmdate_variation12.phpt b/ext/date/tests/gmdate_variation12.phpt
new file mode 100644
index 000000000..8f0146f38
--- /dev/null
+++ b/ext/date/tests/gmdate_variation12.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Test gmdate() function : usage variation - Valid and invalid range of timestamp.
+--FILE--
+<?php
+/* Prototype : string gmdate(string format [, long timestamp])
+ * Description: Format a GMT date/time
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmdate() : usage variation ***\n";
+
+// Initialise all required variables
+date_default_timezone_set('UTC');
+
+$timestamp = mktime(20, 45, 54, 12, 13, 1901);
+echo "\n-- Testing gmdate() function with minimum range of timestamp --\n";
+var_dump( gmdate(DATE_ISO8601, $timestamp) );
+
+$timestamp = mktime(20, 45, 50, 12, 13, 1901);
+echo "\n-- Testing gmdate() function with less than the range of timestamp --\n";
+var_dump( gmdate(DATE_ISO8601, $timestamp) );
+
+echo "\n-- Testing gmdate() function with maximum range of timestamp --\n";
+$timestamp = mktime(03, 14, 07, 1, 19, 2038);
+var_dump( gmdate(DATE_ISO8601, $timestamp) );
+
+echo "\n-- Testing gmdate() function with greater than the range of timestamp --\n";
+$timestamp = mktime(03, 14, 10, 1, 19, 2038);
+var_dump( gmdate(DATE_ISO8601, $timestamp) );
+
+?>
+===DONE===
+--EXPECTREGEX--
+\*\*\* Testing gmdate\(\) : usage variation \*\*\*
+
+-- Testing gmdate\(\) function with minimum range of timestamp --
+string\(24\) "1901-12-13T20:45:54\+0000"
+
+-- Testing gmdate\(\) function with less than the range of timestamp --
+string\(24\) "(1970-01-01T00:00:00\+0000|1901-12-13T20:45:50\+0000)"
+
+-- Testing gmdate\(\) function with maximum range of timestamp --
+string\(24\) "2038-01-19T03:14:07\+0000"
+
+-- Testing gmdate\(\) function with greater than the range of timestamp --
+string\(24\) "(1970-01-01T00:00:00\+0000|2038-01-19T03:14:10\+0000)"
+===DONE===
diff --git a/ext/date/tests/gmdate_variation13.phpt b/ext/date/tests/gmdate_variation13.phpt
new file mode 100644
index 000000000..adc03919e
--- /dev/null
+++ b/ext/date/tests/gmdate_variation13.phpt
@@ -0,0 +1,82 @@
+--TEST--
+Test gmdate() function : usage variation - Passing predefined constants to format argument.
+--FILE--
+<?php
+/* Prototype : string gmdate(string format [, long timestamp])
+ * Description: Format a GMT date/time
+ * Source code: ext/date/php_date.c
+ */
+
+echo "*** Testing gmdate() : usage variation ***\n";
+
+// Initialise all required variables
+date_default_timezone_set('UTC');
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+//array of values to iterate over
+$inputs = array(
+ // Predefined Date constants
+ 'DATE_ATOM Constant' => DATE_ATOM,
+ 'DATE_COOKIE Constant' => DATE_COOKIE,
+ 'DATE_RFC822 Constant' => DATE_RFC822,
+ 'DATE_RFC850 Constant' => DATE_RFC850,
+ 'DATE_RFC1036 Constant' => DATE_RFC1036,
+ 'DATE_RFC1123 Constant' => DATE_RFC1123,
+ 'DATE_RFC2822 Constant' => DATE_RFC2822,
+ 'DATE_RFC3339 Constant' => DATE_RFC3339,
+ 'DATE_RSS Constant' => DATE_RSS,
+ 'DATE_W3C Constant' => DATE_W3C,
+);
+
+// loop through each element of the array for format
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmdate($value, $timestamp) );
+ var_dump( gmdate($value) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmdate() : usage variation ***
+
+--DATE_ATOM Constant--
+string(25) "2008-08-08T08:08:08+00:00"
+string(%d) "%s"
+
+--DATE_COOKIE Constant--
+string(30) "Friday, 08-Aug-08 08:08:08 GMT"
+string(%d) "%s"
+
+--DATE_RFC822 Constant--
+string(29) "Fri, 08 Aug 08 08:08:08 +0000"
+string(%d) "%s"
+
+--DATE_RFC850 Constant--
+string(30) "Friday, 08-Aug-08 08:08:08 GMT"
+string(%d) "%s"
+
+--DATE_RFC1036 Constant--
+string(29) "Fri, 08 Aug 08 08:08:08 +0000"
+string(%d) "%s"
+
+--DATE_RFC1123 Constant--
+string(31) "Fri, 08 Aug 2008 08:08:08 +0000"
+string(%d) "%s"
+
+--DATE_RFC2822 Constant--
+string(31) "Fri, 08 Aug 2008 08:08:08 +0000"
+string(%d) "%s"
+
+--DATE_RFC3339 Constant--
+string(25) "2008-08-08T08:08:08+00:00"
+string(%d) "%s"
+
+--DATE_RSS Constant--
+string(31) "Fri, 08 Aug 2008 08:08:08 +0000"
+string(%d) "%s"
+
+--DATE_W3C Constant--
+string(25) "2008-08-08T08:08:08+00:00"
+string(%d) "%s"
+===DONE===
diff --git a/ext/date/tests/gmdate_variation14.phpt b/ext/date/tests/gmdate_variation14.phpt
new file mode 100644
index 000000000..dfea054c6
--- /dev/null
+++ b/ext/date/tests/gmdate_variation14.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test gmdate() function : usage variation - Passing high positive and negetive float values to timestamp.
+--FILE--
+<?php
+/* Prototype : string gmdate(string format [, long timestamp])
+ * Description: Format a GMT date/time
+ * Source code: ext/date/php_date.c
+ */
+
+echo "*** Testing gmdate() : usage variation ***\n";
+
+// Initialise all required variables
+date_default_timezone_set('UTC');
+$format = DATE_ISO8601;
+
+echo "\n-- Testing gmdate() function with float 12.3456789000e10 to timestamp --\n";
+$timestamp = 12.3456789000e10;
+var_dump( gmdate($format, $timestamp) );
+
+echo "\n-- Testing gmdate() function with float -12.3456789000e10 to timestamp --\n";
+$timestamp = -12.3456789000e10;
+var_dump( gmdate($format, $timestamp) );
+
+?>
+===DONE===
+--EXPECTREGEX--
+\*\*\* Testing gmdate\(\) : usage variation \*\*\*
+
+-- Testing gmdate\(\) function with float 12.3456789000e10 to timestamp --
+string\((24|25)\) "(1935-03-26T04:50:16\+0000|5882-03-11T00:30:00\+0000)"
+
+-- Testing gmdate\(\) function with float -12.3456789000e10 to timestamp --
+string\((24|25)\) "(2004-10-08T19:09:44\+0000|1901-12-13T20:45:52\+0000|-1943-10-22T23:30:00\+0000)"
+===DONE===
diff --git a/ext/date/tests/gmdate_variation2.phpt b/ext/date/tests/gmdate_variation2.phpt
new file mode 100644
index 000000000..c52de9da7
--- /dev/null
+++ b/ext/date/tests/gmdate_variation2.phpt
@@ -0,0 +1,210 @@
+--TEST--
+Test gmdate() function : usage variation - Passing unexpected values to timestamp argument.
+--FILE--
+<?php
+/* Prototype : string gmdate(string format [, long timestamp])
+ * Description: Format a GMT date/time
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmdate() : usage variation ***\n";
+
+
+// Initialise all required variables
+date_default_timezone_set('UTC');
+$format = DATE_ISO8601;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmdate($format, $value) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmdate() : usage variation ***
+
+--int 0--
+string(24) "1970-01-01T00:00:00+0000"
+
+--int 1--
+string(24) "1970-01-01T00:00:01+0000"
+
+--int 12345--
+string(24) "1970-01-01T03:25:45+0000"
+
+--int -12345--
+string(24) "1969-12-31T20:34:15+0000"
+
+--float 10.5--
+string(24) "1970-01-01T00:00:10+0000"
+
+--float -10.5--
+string(24) "1969-12-31T23:59:50+0000"
+
+--float .5--
+string(24) "1970-01-01T00:00:00+0000"
+
+--empty array--
+
+Warning: gmdate() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: gmdate() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: gmdate() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: gmdate() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+string(24) "1970-01-01T00:00:00+0000"
+
+--lowercase null--
+string(24) "1970-01-01T00:00:00+0000"
+
+--lowercase true--
+string(24) "1970-01-01T00:00:01+0000"
+
+--lowercase false--
+string(24) "1970-01-01T00:00:00+0000"
+
+--uppercase TRUE--
+string(24) "1970-01-01T00:00:01+0000"
+
+--uppercase FALSE--
+string(24) "1970-01-01T00:00:00+0000"
+
+--empty string DQ--
+
+Warning: gmdate() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: gmdate() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--string DQ--
+
+Warning: gmdate() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--string SQ--
+
+Warning: gmdate() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--mixed case string--
+
+Warning: gmdate() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--heredoc--
+
+Warning: gmdate() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: gmdate() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: gmdate() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+
+--undefined var--
+string(24) "1970-01-01T00:00:00+0000"
+
+--unset var--
+string(24) "1970-01-01T00:00:00+0000"
+===DONE===
diff --git a/ext/date/tests/gmdate_variation3.phpt b/ext/date/tests/gmdate_variation3.phpt
new file mode 100644
index 000000000..a93d6e923
--- /dev/null
+++ b/ext/date/tests/gmdate_variation3.phpt
@@ -0,0 +1,59 @@
+--TEST--
+Test gmdate() function : usage variation - Passing numeric representation of day formats.
+--FILE--
+<?php
+/* Prototype : string gmdate(string format [, long timestamp])
+ * Description: Format a GMT date/time
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmdate() : usage variation ***\n";
+
+// Initialise all required variables
+date_default_timezone_set('UTC');
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+//array of values to iterate over
+$inputs = array(
+
+ 'Day with leading zeros' => 'd',
+ 'Day without leading zeros' => 'j',
+ 'ISO representation' => 'N',
+ 'Numeric representation of day' => 'w',
+ 'Day of the year' => 'z'
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmdate($value) );
+ var_dump( gmdate($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmdate() : usage variation ***
+
+--Day with leading zeros--
+string(%d) "%d"
+string(2) "08"
+
+--Day without leading zeros--
+string(%d) "%d"
+string(1) "8"
+
+--ISO representation--
+string(%d) "%d"
+string(1) "5"
+
+--Numeric representation of day--
+string(%d) "%d"
+string(1) "5"
+
+--Day of the year--
+string(%d) "%d"
+string(3) "220"
+===DONE===
diff --git a/ext/date/tests/gmdate_variation4.phpt b/ext/date/tests/gmdate_variation4.phpt
new file mode 100644
index 000000000..bb97b567c
--- /dev/null
+++ b/ext/date/tests/gmdate_variation4.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test gmdate() function : usage variation - Passing textual representation of day formats.
+--FILE--
+<?php
+/* Prototype : string gmdate(string format [, long timestamp])
+ * Description: Format a GMT date/time
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmdate() : usage variation ***\n";
+
+// Initialise all required variables
+date_default_timezone_set('UTC');
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+echo "\n-- Testing gmdate() function with partial textual representation of day --\n";
+var_dump( gmdate('D') );
+var_dump( gmdate('D', $timestamp) );
+
+echo "\n-- Testing gmdate() function with full textual representation of day --\n";
+var_dump( gmdate('l') );
+var_dump( gmdate('l', $timestamp) );
+
+echo "\n-- Testing gmdate() function with English ordinal suffix --\n";
+var_dump( gmdate('S') );
+var_dump( gmdate('S', $timestamp) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmdate() : usage variation ***
+
+-- Testing gmdate() function with partial textual representation of day --
+string(%d) "%s"
+string(3) "Fri"
+
+-- Testing gmdate() function with full textual representation of day --
+string(%d) "%s"
+string(6) "Friday"
+
+-- Testing gmdate() function with English ordinal suffix --
+string(%d) "%s"
+string(2) "th"
+===DONE===
diff --git a/ext/date/tests/gmdate_variation5.phpt b/ext/date/tests/gmdate_variation5.phpt
new file mode 100644
index 000000000..d40488a69
--- /dev/null
+++ b/ext/date/tests/gmdate_variation5.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test gmdate() function : usage variation - Passing Week representation to format.
+--FILE--
+<?php
+/* Prototype : string gmdate(string format [, long timestamp])
+ * Description: Format a GMT date/time
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmdate() : usage variation ***\n";
+
+// Initialise all required variables
+date_default_timezone_set('UTC');
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+echo "\n-- Testing gmdate() function with ISO-8601 week number of year format --\n";
+var_dump( gmdate('W') );
+var_dump( gmdate('W', $timestamp) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmdate() : usage variation ***
+
+-- Testing gmdate() function with ISO-8601 week number of year format --
+string(%d) "%d"
+string(2) "32"
+===DONE===
diff --git a/ext/date/tests/gmdate_variation6.phpt b/ext/date/tests/gmdate_variation6.phpt
new file mode 100644
index 000000000..f5b63a5b3
--- /dev/null
+++ b/ext/date/tests/gmdate_variation6.phpt
@@ -0,0 +1,61 @@
+--TEST--
+Test gmdate() function : usage variation - Passing Month format options to format argument.
+--FILE--
+<?php
+/* Prototype : string gmdate(string format [, long timestamp])
+ * Description: Format a GMT date/time
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmdate() : usage variation ***\n";
+
+// Initialise all required variables
+date_default_timezone_set('UTC');
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+echo "\n-- Testing gmdate() function with full textual representation of month format --\n";
+var_dump( gmdate('F') );
+var_dump( gmdate('F', $timestamp) );
+
+echo "\n-- Testing gmdate() function with numeric representation of month format --\n";
+var_dump( gmdate('m') );
+var_dump( gmdate('m', $timestamp) );
+
+echo "\n-- Testing gmdate() function with short textual representation of month format --\n";
+var_dump( gmdate('M') );
+var_dump( gmdate('M', $timestamp) );
+
+echo "\n-- Testing gmdate() function with numeric representation of month without leading zeros format --\n";
+var_dump( gmdate('n') );
+var_dump( gmdate('n', $timestamp) );
+
+echo "\n-- Testing gmdate() function with number of days in a month format --\n";
+var_dump( gmdate('t') );
+var_dump( gmdate('t', $timestamp) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmdate() : usage variation ***
+
+-- Testing gmdate() function with full textual representation of month format --
+string(%d) "%s"
+string(6) "August"
+
+-- Testing gmdate() function with numeric representation of month format --
+string(%d) "%d"
+string(2) "08"
+
+-- Testing gmdate() function with short textual representation of month format --
+string(%d) "%s"
+string(3) "Aug"
+
+-- Testing gmdate() function with numeric representation of month without leading zeros format --
+string(%d) "%d"
+string(1) "8"
+
+-- Testing gmdate() function with number of days in a month format --
+string(%d) "%d"
+string(2) "31"
+===DONE===
diff --git a/ext/date/tests/gmdate_variation7.phpt b/ext/date/tests/gmdate_variation7.phpt
new file mode 100644
index 000000000..8d9c1b0b9
--- /dev/null
+++ b/ext/date/tests/gmdate_variation7.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test gmdate() function : usage variation - Passing Year format options to format argument.
+--FILE--
+<?php
+/* Prototype : string gmdate(string format [, long timestamp])
+ * Description: Format a GMT date/time
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmdate() : usage variation ***\n";
+
+// Initialise all required variables
+date_default_timezone_set('UTC');
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+$timestamp_non_leap_year = mktime(8, 8, 8, 8, 8, 2007);
+
+echo "\n-- Testing gmdate() function with checking non leap year using Leap Year format --\n";
+var_dump( gmdate('L', $timestamp_non_leap_year) );
+
+echo "\n-- Testing gmdate() function with checking leap year using Leap Year format --\n";
+var_dump( gmdate('L') );
+var_dump( gmdate('L', $timestamp) );
+
+echo "\n-- Testing gmdate() function with ISO-8601 year number format --\n";
+var_dump( gmdate('o') );
+var_dump( gmdate('o', $timestamp) );
+
+echo "\n-- Testing gmdate() function with full numeric representation of year format --\n";
+var_dump( gmdate('Y') );
+var_dump( gmdate('Y', $timestamp) );
+
+echo "\n-- Testing gmdate() function with 2 digit representation year format --\n";
+var_dump( gmdate('y') );
+var_dump( gmdate('y', $timestamp) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmdate() : usage variation ***
+
+-- Testing gmdate() function with checking non leap year using Leap Year format --
+string(1) "0"
+
+-- Testing gmdate() function with checking leap year using Leap Year format --
+string(1) "%d"
+string(1) "1"
+
+-- Testing gmdate() function with ISO-8601 year number format --
+string(4) "%d"
+string(4) "2008"
+
+-- Testing gmdate() function with full numeric representation of year format --
+string(4) "%d"
+string(4) "2008"
+
+-- Testing gmdate() function with 2 digit representation year format --
+string(2) "%d"
+string(2) "08"
+===DONE===
diff --git a/ext/date/tests/gmdate_variation8.phpt b/ext/date/tests/gmdate_variation8.phpt
new file mode 100644
index 000000000..8d9c1b0b9
--- /dev/null
+++ b/ext/date/tests/gmdate_variation8.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test gmdate() function : usage variation - Passing Year format options to format argument.
+--FILE--
+<?php
+/* Prototype : string gmdate(string format [, long timestamp])
+ * Description: Format a GMT date/time
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmdate() : usage variation ***\n";
+
+// Initialise all required variables
+date_default_timezone_set('UTC');
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+$timestamp_non_leap_year = mktime(8, 8, 8, 8, 8, 2007);
+
+echo "\n-- Testing gmdate() function with checking non leap year using Leap Year format --\n";
+var_dump( gmdate('L', $timestamp_non_leap_year) );
+
+echo "\n-- Testing gmdate() function with checking leap year using Leap Year format --\n";
+var_dump( gmdate('L') );
+var_dump( gmdate('L', $timestamp) );
+
+echo "\n-- Testing gmdate() function with ISO-8601 year number format --\n";
+var_dump( gmdate('o') );
+var_dump( gmdate('o', $timestamp) );
+
+echo "\n-- Testing gmdate() function with full numeric representation of year format --\n";
+var_dump( gmdate('Y') );
+var_dump( gmdate('Y', $timestamp) );
+
+echo "\n-- Testing gmdate() function with 2 digit representation year format --\n";
+var_dump( gmdate('y') );
+var_dump( gmdate('y', $timestamp) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmdate() : usage variation ***
+
+-- Testing gmdate() function with checking non leap year using Leap Year format --
+string(1) "0"
+
+-- Testing gmdate() function with checking leap year using Leap Year format --
+string(1) "%d"
+string(1) "1"
+
+-- Testing gmdate() function with ISO-8601 year number format --
+string(4) "%d"
+string(4) "2008"
+
+-- Testing gmdate() function with full numeric representation of year format --
+string(4) "%d"
+string(4) "2008"
+
+-- Testing gmdate() function with 2 digit representation year format --
+string(2) "%d"
+string(2) "08"
+===DONE===
diff --git a/ext/date/tests/gmdate_variation9.phpt b/ext/date/tests/gmdate_variation9.phpt
new file mode 100644
index 000000000..e210557ac
--- /dev/null
+++ b/ext/date/tests/gmdate_variation9.phpt
@@ -0,0 +1,81 @@
+--TEST--
+Test gmdate() function : usage variation - Passing Time format options to format argument.
+--FILE--
+<?php
+/* Prototype : string gmdate(string format [, long timestamp])
+ * Description: Format a GMT date/time
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmdate() : usage variation ***\n";
+
+// Initialise all required variables
+date_default_timezone_set('UTC');
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+$time_formats = array(
+
+ 'Lowercase Ante meridiem and post meridiem' => 'a',
+ 'Uppercase Ante meridiem and post meridiem' => 'a',
+ 'Swatch Internet time' => 'B',
+ '12-hour format without leading zeros' => 'g',
+ '24-hour format without leading zeros' => 'G',
+ '12-hour format with leading zeros' => 'h',
+ '24-hour format with leading zeros' => 'H',
+ 'Minutes with leading zeros' => 'i',
+ 'Seconds with leading zeros' => 's',
+ 'Milliseconds' => 'u',
+);
+
+foreach($time_formats as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmdate($value) );
+ var_dump( gmdate($value, $timestamp) );
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmdate() : usage variation ***
+
+--Lowercase Ante meridiem and post meridiem--
+string(2) "%s"
+string(2) "am"
+
+--Uppercase Ante meridiem and post meridiem--
+string(2) "%s"
+string(2) "am"
+
+--Swatch Internet time--
+string(%d) "%d"
+string(3) "380"
+
+--12-hour format without leading zeros--
+string(%d) "%d"
+string(1) "8"
+
+--24-hour format without leading zeros--
+string(%d) "%d"
+string(1) "8"
+
+--12-hour format with leading zeros--
+string(%d) "%d"
+string(2) "08"
+
+--24-hour format with leading zeros--
+string(2) "%d"
+string(2) "08"
+
+--Minutes with leading zeros--
+string(2) "%d"
+string(2) "08"
+
+--Seconds with leading zeros--
+string(2) "%d"
+string(2) "08"
+
+--Milliseconds--
+string(%d) "%d"
+string(6) "000000"
+===DONE===
diff --git a/ext/date/tests/gmmktime_basic.phpt b/ext/date/tests/gmmktime_basic.phpt
new file mode 100644
index 000000000..81abb5f2b
--- /dev/null
+++ b/ext/date/tests/gmmktime_basic.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test gmmktime() function : basic functionality
+--FILE--
+<?php
+/* Prototype : int gmmktime([int hour [, int min [, int sec [, int mon [, int day [, int year]]]]]])
+ * Description: Get UNIX timestamp for a GMT date
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmmktime() : basic functionality ***\n";
+
+// Initialise all required variables
+$hour = 8;
+$min = 8;
+$sec = 8;
+$mon = 8;
+$day = 8;
+$year = 2008;
+
+// Calling gmmktime() with all possible arguments
+var_dump( gmmktime($hour, $min, $sec, $mon, $day, $year) );
+
+// Calling gmmktime() with mandatory arguments
+var_dump( gmmktime() );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmmktime() : basic functionality ***
+int(1218182888)
+
+Strict Standards: gmmktime(): You should be using the time() function instead in %s on line %d
+int(%d)
+===DONE===
diff --git a/ext/date/tests/gmmktime_error.phpt b/ext/date/tests/gmmktime_error.phpt
new file mode 100644
index 000000000..5fca888d1
--- /dev/null
+++ b/ext/date/tests/gmmktime_error.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test gmmktime() function : error conditions
+--FILE--
+<?php
+/* Prototype : int gmmktime([int hour [, int min [, int sec [, int mon [, int day [, int year]]]]]])
+ * Description: Get UNIX timestamp for a GMT date
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmmktime() : error conditions ***\n";
+
+//Test gmmktime with one more than the expected number of arguments
+echo "\n-- Testing gmmktime() function with more than expected no. of arguments --\n";
+$hour = 8;
+$min = 8;
+$sec = 8;
+$mon = 8;
+$day = 8;
+$year = 2008;
+$extra_arg1 = 10;
+$extra_arg2 = 10;
+
+var_dump( gmmktime($hour, $min, $sec, $mon, $day, $year, $extra_arg1) );
+
+var_dump( gmmktime($hour, $min, $sec, $mon, $day, $year, $extra_arg1, $extra_arg2) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmmktime() : error conditions ***
+
+-- Testing gmmktime() function with more than expected no. of arguments --
+
+Strict Standards: gmmktime(): The is_dst parameter is deprecated in %s on line %d
+int(1218182888)
+
+Warning: gmmktime() expects at most 7 parameters, 8 given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/gmmktime_variation1.phpt b/ext/date/tests/gmmktime_variation1.phpt
new file mode 100644
index 000000000..f84d99b9c
--- /dev/null
+++ b/ext/date/tests/gmmktime_variation1.phpt
@@ -0,0 +1,194 @@
+--TEST--
+Test gmmktime() function : usage variation - Passing unexpected values to first argument hour.
+--FILE--
+<?php
+/* Prototype : int gmmktime([int hour [, int min [, int sec [, int mon [, int day [, int year]]]]]])
+ * Description: Get UNIX timestamp for a GMT date
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmmktime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$min = 8;
+$sec = 8;
+$mon = 8;
+$day = 8;
+$year = 2008;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for hour
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmmktime($value, $min, $sec, $mon, $day, $year) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmmktime() : usage variation ***
+
+--float 10.5--
+int(1218190088)
+
+--float -10.5--
+int(1218118088)
+
+--float .5--
+int(1218154088)
+
+--empty array--
+
+Warning: gmmktime() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: gmmktime() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: gmmktime() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: gmmktime() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+int(1218154088)
+
+--lowercase null--
+int(1218154088)
+
+--lowercase true--
+int(1218157688)
+
+--lowercase false--
+int(1218154088)
+
+--uppercase TRUE--
+int(1218157688)
+
+--uppercase FALSE--
+int(1218154088)
+
+--empty string DQ--
+
+Warning: gmmktime() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: gmmktime() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--string DQ--
+
+Warning: gmmktime() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--string SQ--
+
+Warning: gmmktime() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--mixed case string--
+
+Warning: gmmktime() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--heredoc--
+
+Warning: gmmktime() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: gmmktime() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: gmmktime() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+
+--undefined var--
+int(1218154088)
+
+--unset var--
+int(1218154088)
+===DONE===
diff --git a/ext/date/tests/gmmktime_variation2.phpt b/ext/date/tests/gmmktime_variation2.phpt
new file mode 100644
index 000000000..e74af392f
--- /dev/null
+++ b/ext/date/tests/gmmktime_variation2.phpt
@@ -0,0 +1,194 @@
+--TEST--
+Test gmmktime() function : usage variation - Passing unexpected values to second argument minute.
+--FILE--
+<?php
+/* Prototype : int gmmktime([int hour [, int min [, int sec [, int mon [, int day [, int year]]]]]])
+ * Description: Get UNIX timestamp for a GMT date
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmmktime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$hour = 8;
+$sec = 8;
+$mon = 8;
+$day = 8;
+$year = 2008;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for min
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmmktime($hour, $value, $sec, $mon, $day, $year) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmmktime() : usage variation ***
+
+--float 10.5--
+int(1218183008)
+
+--float -10.5--
+int(1218181808)
+
+--float .5--
+int(1218182408)
+
+--empty array--
+
+Warning: gmmktime() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: gmmktime() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: gmmktime() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: gmmktime() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+int(1218182408)
+
+--lowercase null--
+int(1218182408)
+
+--lowercase true--
+int(1218182468)
+
+--lowercase false--
+int(1218182408)
+
+--uppercase TRUE--
+int(1218182468)
+
+--uppercase FALSE--
+int(1218182408)
+
+--empty string DQ--
+
+Warning: gmmktime() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: gmmktime() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--string DQ--
+
+Warning: gmmktime() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--string SQ--
+
+Warning: gmmktime() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--mixed case string--
+
+Warning: gmmktime() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--heredoc--
+
+Warning: gmmktime() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: gmmktime() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: gmmktime() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+
+--undefined var--
+int(1218182408)
+
+--unset var--
+int(1218182408)
+===DONE===
diff --git a/ext/date/tests/gmmktime_variation3.phpt b/ext/date/tests/gmmktime_variation3.phpt
new file mode 100644
index 000000000..d180e829a
--- /dev/null
+++ b/ext/date/tests/gmmktime_variation3.phpt
@@ -0,0 +1,194 @@
+--TEST--
+Test gmmktime() function : usage variation - Passing unexpected values to third argument seconds.
+--FILE--
+<?php
+/* Prototype : int gmmktime([int hour [, int min [, int sec [, int mon [, int day [, int year]]]]]])
+ * Description: Get UNIX timestamp for a GMT date
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmmktime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$hour = 8;
+$min = 8;
+$mon = 8;
+$day = 8;
+$year = 2008;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for sec
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmmktime($hour, $min, $value, $mon, $day, $year) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmmktime() : usage variation ***
+
+--float 10.5--
+int(1218182890)
+
+--float -10.5--
+int(1218182870)
+
+--float .5--
+int(1218182880)
+
+--empty array--
+
+Warning: gmmktime() expects parameter 3 to be long, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: gmmktime() expects parameter 3 to be long, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: gmmktime() expects parameter 3 to be long, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: gmmktime() expects parameter 3 to be long, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+int(1218182880)
+
+--lowercase null--
+int(1218182880)
+
+--lowercase true--
+int(1218182881)
+
+--lowercase false--
+int(1218182880)
+
+--uppercase TRUE--
+int(1218182881)
+
+--uppercase FALSE--
+int(1218182880)
+
+--empty string DQ--
+
+Warning: gmmktime() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: gmmktime() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+--string DQ--
+
+Warning: gmmktime() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+--string SQ--
+
+Warning: gmmktime() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+--mixed case string--
+
+Warning: gmmktime() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+--heredoc--
+
+Warning: gmmktime() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: gmmktime() expects parameter 3 to be long, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: gmmktime() expects parameter 3 to be long, object given in %s on line %d
+bool(false)
+
+--undefined var--
+int(1218182880)
+
+--unset var--
+int(1218182880)
+===DONE===
diff --git a/ext/date/tests/gmmktime_variation4.phpt b/ext/date/tests/gmmktime_variation4.phpt
new file mode 100644
index 000000000..909311928
--- /dev/null
+++ b/ext/date/tests/gmmktime_variation4.phpt
@@ -0,0 +1,194 @@
+--TEST--
+Test gmmktime() function : usage variation - Passing unexpected values to fourth argument month.
+--FILE--
+<?php
+/* Prototype : int gmmktime([int hour [, int min [, int sec [, int mon [, int day [, int year]]]]]])
+ * Description: Get UNIX timestamp for a GMT date
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmmktime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$hour = 8;
+$min = 8;
+$sec = 8;
+$day = 8;
+$year = 2008;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for mon
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmmktime($hour, $min, $sec, $value, $day, $year) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmmktime() : usage variation ***
+
+--float 10.5--
+int(1223453288)
+
+--float -10.5--
+int(1170922088)
+
+--float .5--
+int(1197101288)
+
+--empty array--
+
+Warning: gmmktime() expects parameter 4 to be long, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: gmmktime() expects parameter 4 to be long, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: gmmktime() expects parameter 4 to be long, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: gmmktime() expects parameter 4 to be long, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+int(1197101288)
+
+--lowercase null--
+int(1197101288)
+
+--lowercase true--
+int(1199779688)
+
+--lowercase false--
+int(1197101288)
+
+--uppercase TRUE--
+int(1199779688)
+
+--uppercase FALSE--
+int(1197101288)
+
+--empty string DQ--
+
+Warning: gmmktime() expects parameter 4 to be long, string given in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: gmmktime() expects parameter 4 to be long, string given in %s on line %d
+bool(false)
+
+--string DQ--
+
+Warning: gmmktime() expects parameter 4 to be long, string given in %s on line %d
+bool(false)
+
+--string SQ--
+
+Warning: gmmktime() expects parameter 4 to be long, string given in %s on line %d
+bool(false)
+
+--mixed case string--
+
+Warning: gmmktime() expects parameter 4 to be long, string given in %s on line %d
+bool(false)
+
+--heredoc--
+
+Warning: gmmktime() expects parameter 4 to be long, string given in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: gmmktime() expects parameter 4 to be long, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: gmmktime() expects parameter 4 to be long, object given in %s on line %d
+bool(false)
+
+--undefined var--
+int(1197101288)
+
+--unset var--
+int(1197101288)
+===DONE===
diff --git a/ext/date/tests/gmmktime_variation5.phpt b/ext/date/tests/gmmktime_variation5.phpt
new file mode 100644
index 000000000..dd1ca3e9c
--- /dev/null
+++ b/ext/date/tests/gmmktime_variation5.phpt
@@ -0,0 +1,194 @@
+--TEST--
+Test gmmktime() function : usage variation - Passing unexpected values to fifth argument day.
+--FILE--
+<?php
+/* Prototype : int gmmktime([int hour [, int min [, int sec [, int mon [, int day [, int year]]]]]])
+ * Description: Get UNIX timestamp for a GMT date
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmmktime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$hour = 8;
+$min = 8;
+$sec = 8;
+$mon = 8;
+$year = 2008;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for day
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmmktime($hour, $min, $sec, $mon, $value, $year) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmmktime() : usage variation ***
+
+--float 10.5--
+int(1218355688)
+
+--float -10.5--
+int(1216627688)
+
+--float .5--
+int(1217491688)
+
+--empty array--
+
+Warning: gmmktime() expects parameter 5 to be long, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: gmmktime() expects parameter 5 to be long, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: gmmktime() expects parameter 5 to be long, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: gmmktime() expects parameter 5 to be long, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+int(1217491688)
+
+--lowercase null--
+int(1217491688)
+
+--lowercase true--
+int(1217578088)
+
+--lowercase false--
+int(1217491688)
+
+--uppercase TRUE--
+int(1217578088)
+
+--uppercase FALSE--
+int(1217491688)
+
+--empty string DQ--
+
+Warning: gmmktime() expects parameter 5 to be long, string given in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: gmmktime() expects parameter 5 to be long, string given in %s on line %d
+bool(false)
+
+--string DQ--
+
+Warning: gmmktime() expects parameter 5 to be long, string given in %s on line %d
+bool(false)
+
+--string SQ--
+
+Warning: gmmktime() expects parameter 5 to be long, string given in %s on line %d
+bool(false)
+
+--mixed case string--
+
+Warning: gmmktime() expects parameter 5 to be long, string given in %s on line %d
+bool(false)
+
+--heredoc--
+
+Warning: gmmktime() expects parameter 5 to be long, string given in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: gmmktime() expects parameter 5 to be long, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: gmmktime() expects parameter 5 to be long, object given in %s on line %d
+bool(false)
+
+--undefined var--
+int(1217491688)
+
+--unset var--
+int(1217491688)
+===DONE===
diff --git a/ext/date/tests/gmmktime_variation6.phpt b/ext/date/tests/gmmktime_variation6.phpt
new file mode 100644
index 000000000..4877556b7
--- /dev/null
+++ b/ext/date/tests/gmmktime_variation6.phpt
@@ -0,0 +1,190 @@
+--TEST--
+Test gmmktime() function : usage variation - Passing unexpected values to sixth argument year.
+--FILE--
+<?php
+/* Prototype : int gmmktime([int hour [, int min [, int sec [, int mon [, int day [, int year]]]]]])
+ * Description: Get UNIX timestamp for a GMT date
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmmktime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$hour = 8;
+$min = 8;
+$sec = 8;
+$mon = 8;
+$day = 8;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for year
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmmktime($hour, $min, $sec, $mon, $day, $value) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmmktime() : usage variation ***
+
+--float 10.5--
+int(1281254888)
+
+--float .5--
+int(965722088)
+
+--empty array--
+
+Warning: gmmktime() expects parameter 6 to be long, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: gmmktime() expects parameter 6 to be long, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: gmmktime() expects parameter 6 to be long, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: gmmktime() expects parameter 6 to be long, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+int(965722088)
+
+--lowercase null--
+int(965722088)
+
+--lowercase true--
+int(997258088)
+
+--lowercase false--
+int(965722088)
+
+--uppercase TRUE--
+int(997258088)
+
+--uppercase FALSE--
+int(965722088)
+
+--empty string DQ--
+
+Warning: gmmktime() expects parameter 6 to be long, string given in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: gmmktime() expects parameter 6 to be long, string given in %s on line %d
+bool(false)
+
+--string DQ--
+
+Warning: gmmktime() expects parameter 6 to be long, string given in %s on line %d
+bool(false)
+
+--string SQ--
+
+Warning: gmmktime() expects parameter 6 to be long, string given in %s on line %d
+bool(false)
+
+--mixed case string--
+
+Warning: gmmktime() expects parameter 6 to be long, string given in %s on line %d
+bool(false)
+
+--heredoc--
+
+Warning: gmmktime() expects parameter 6 to be long, string given in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: gmmktime() expects parameter 6 to be long, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: gmmktime() expects parameter 6 to be long, object given in %s on line %d
+bool(false)
+
+--undefined var--
+int(965722088)
+
+--unset var--
+int(965722088)
+===DONE===
diff --git a/ext/date/tests/gmmktime_variation7.phpt b/ext/date/tests/gmmktime_variation7.phpt
new file mode 100644
index 000000000..3d0d25a00
--- /dev/null
+++ b/ext/date/tests/gmmktime_variation7.phpt
@@ -0,0 +1,54 @@
+--TEST--
+Test gmmktime() function : usage variation - Checking with few optional arguments.
+--FILE--
+<?php
+/* Prototype : int gmmktime([int hour [, int min [, int sec [, int mon [, int day [, int year]]]]]])
+ * Description: Get UNIX timestamp for a GMT date
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmmktime() : usage variation ***\n";
+
+// Initialise all required variables
+$hour = 8;
+$min = 8;
+$sec = 8;
+$mon = 8;
+$day = 8;
+
+echo "\n-- Testing gmmktime() function with one optional argument --\n";
+var_dump( gmmktime($hour) );
+
+echo "\n-- Testing gmmktime() function with two optional argument --\n";
+var_dump( gmmktime($hour, $min) );
+
+echo "\n-- Testing gmmktime() function with three optional argument --\n";
+var_dump( gmmktime($hour, $min, $sec) );
+
+echo "\n-- Testing gmmktime() function with four optional argument --\n";
+var_dump( gmmktime($hour, $min, $sec, $mon) );
+
+echo "\n-- Testing gmmktime() function with five optional argument --\n";
+var_dump( gmmktime($hour, $min, $sec, $mon, $day) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmmktime() : usage variation ***
+
+-- Testing gmmktime() function with one optional argument --
+int(%d)
+
+-- Testing gmmktime() function with two optional argument --
+int(%d)
+
+-- Testing gmmktime() function with three optional argument --
+int(%d)
+
+-- Testing gmmktime() function with four optional argument --
+int(%d)
+
+-- Testing gmmktime() function with five optional argument --
+int(%d)
+===DONE===
diff --git a/ext/date/tests/gmmktime_variation8.phpt b/ext/date/tests/gmmktime_variation8.phpt
new file mode 100644
index 000000000..b0c56a127
--- /dev/null
+++ b/ext/date/tests/gmmktime_variation8.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Test gmmktime() function : usage variation - Passing octal and hexadecimal values to arguments.
+--FILE--
+<?php
+/* Prototype : int gmmktime([int hour [, int min [, int sec [, int mon [, int day [, int year]]]]]])
+ * Description: Get UNIX timestamp for a GMT date
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmmktime() : usage variation ***\n";
+
+// Initialise all required variables
+$hour = 010;
+$min = 010;
+$sec = 010;
+$mon = 010;
+$day = 010;
+$year = 03730;
+
+echo "\n-- Testing gmmktime() function with supplying octal values to arguments --\n";
+var_dump( gmmktime($hour, $min, $sec, $mon, $day, $year) );
+
+// Initialise all required variables
+$hour = 0x8;
+$min = 0x8;
+$sec = 0x8;
+$mon = 0x8;
+$day = 0x8;
+$year = 0x7D8;
+
+echo "\n-- Testing gmmktime() function with supplying hexa decimal values to arguments --\n";
+var_dump( gmmktime($hour, $min, $sec, $mon, $day, $year) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmmktime() : usage variation ***
+
+-- Testing gmmktime() function with supplying octal values to arguments --
+int(1218182888)
+
+-- Testing gmmktime() function with supplying hexa decimal values to arguments --
+int(1218182888)
+===DONE===
diff --git a/ext/date/tests/gmmktime_variation9.phpt b/ext/date/tests/gmmktime_variation9.phpt
new file mode 100644
index 000000000..fa463e0d6
--- /dev/null
+++ b/ext/date/tests/gmmktime_variation9.phpt
@@ -0,0 +1,62 @@
+--TEST--
+Test gmmktime() function : usage variation - Passing positive and negative float values to arguments.
+--FILE--
+<?php
+/* Prototype : int gmmktime([int hour [, int min [, int sec [, int mon [, int day [, int year]]]]]])
+ * Description: Get UNIX timestamp for a GMT date
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmmktime() : usage variation ***\n";
+
+//Initialise variables
+$hour = 8;
+$min = 8;
+$sec = 8;
+$mon = 8;
+$day = 8;
+$year = 2008;
+
+$inputs = array(
+
+ 'float 123456' => 123456,
+ 'float -123456' => -123456,
+ 'float -10.5' => -10.5,
+);
+
+// loop through each element of the array for min
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmmktime($value, $min, $sec, $mon, $day, $year) );
+ var_dump( gmmktime($hour, $value, $sec, $mon, $day, $year) );
+ var_dump( gmmktime($hour, $min, $value, $mon, $day, $year) );
+ var_dump( gmmktime($hour, $min, $sec, $value, $day, $year) );
+ var_dump( gmmktime($hour, $min, $sec, $mon, $value, $value) );
+}
+?>
+===DONE===
+--EXPECTREGEX--
+\*\*\* Testing gmmktime\(\) : usage variation \*\*\*
+
+--float 123456--
+int\(1662595688\)
+int\(1225589768\)
+int\(1218306336\)
+(bool|int)\((false|325855037288)\)
+(bool|int)\((false|3844412784488)\)
+
+--float -123456--
+int\(773712488\)
+int\(1210775048\)
+int\(1218059424\)
+(bool|int)\((false|-323460834712)\)
+(bool|int)\((false|-3968710530712)\)
+
+--float -10.5--
+int\(1218118088\)
+int\(1218181808\)
+int\(1218182870\)
+int\(1170922088\)
+(bool|int)\((false|-62465356312)\)
+===DONE===
diff --git a/ext/date/tests/gmstrftime_basic.phpt b/ext/date/tests/gmstrftime_basic.phpt
new file mode 100644
index 000000000..17bad69d0
--- /dev/null
+++ b/ext/date/tests/gmstrftime_basic.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test gmstrftime() function : basic functionality
+--FILE--
+<?php
+/* Prototype : string gmstrftime(string format [, int timestamp])
+ * Description: Format a GMT/UCT time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmstrftime() : basic functionality ***\n";
+
+// Initialise all required variables
+$format = '%b %d %Y %H:%M:%S';
+$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
+
+// Calling gmstrftime() with all possible arguments
+var_dump( gmstrftime($format, $timestamp) );
+
+// Calling gmstrftime() with mandatory arguments
+var_dump( gmstrftime($format) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmstrftime() : basic functionality ***
+string(20) "Aug 08 2008 08:08:08"
+string(%d) "%s %d %d %d:%d:%d"
+===DONE===
diff --git a/ext/date/tests/gmstrftime_error.phpt b/ext/date/tests/gmstrftime_error.phpt
new file mode 100644
index 000000000..d28780fe0
--- /dev/null
+++ b/ext/date/tests/gmstrftime_error.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Test gmstrftime() function : error conditions
+--FILE--
+<?php
+/* Prototype : string gmstrftime(string format [, int timestamp])
+ * Description: Format a GMT/UCT time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmstrftime() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing gmstrftime() function with Zero arguments --\n";
+var_dump( gmstrftime() );
+
+//Test gmstrftime with one more than the expected number of arguments
+echo "\n-- Testing gmstrftime() function with more than expected no. of arguments --\n";
+$format = '%b %d %Y %H:%M:%S';
+$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
+$extra_arg = 10;
+var_dump( gmstrftime($format, $timestamp, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmstrftime() : error conditions ***
+
+-- Testing gmstrftime() function with Zero arguments --
+
+Warning: gmstrftime() expects at least 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing gmstrftime() function with more than expected no. of arguments --
+
+Warning: gmstrftime() expects at most 2 parameters, 3 given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/gmstrftime_variation1.phpt b/ext/date/tests/gmstrftime_variation1.phpt
new file mode 100644
index 000000000..d123fb254
--- /dev/null
+++ b/ext/date/tests/gmstrftime_variation1.phpt
@@ -0,0 +1,220 @@
+--TEST--
+Test gmstrftime() function : usage variation - Passing unexpected values to first argument 'format'.
+--FILE--
+<?php
+/* Prototype : string gmstrftime(string format [, int timestamp])
+ * Description: Format a GMT/UCT time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmstrftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for format
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmstrftime($value) );
+ var_dump( gmstrftime($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmstrftime() : usage variation ***
+
+--int 0--
+string(1) "0"
+string(1) "0"
+
+--int 1--
+string(1) "1"
+string(1) "1"
+
+--int 12345--
+string(5) "12345"
+string(5) "12345"
+
+--int -12345--
+string(6) "-12345"
+string(6) "-12345"
+
+--float 10.5--
+string(4) "10.5"
+string(4) "10.5"
+
+--float -10.5--
+string(5) "-10.5"
+string(5) "-10.5"
+
+--float 12.3456789000e10--
+string(12) "123456789000"
+string(12) "123456789000"
+
+--float -12.3456789000e10--
+string(13) "-123456789000"
+string(13) "-123456789000"
+
+--float .5--
+string(3) "0.5"
+string(3) "0.5"
+
+--empty array--
+
+Warning: gmstrftime() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+Warning: gmstrftime() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: gmstrftime() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+Warning: gmstrftime() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: gmstrftime() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+Warning: gmstrftime() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: gmstrftime() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+Warning: gmstrftime() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+bool(false)
+bool(false)
+
+--lowercase null--
+bool(false)
+bool(false)
+
+--lowercase true--
+string(1) "1"
+string(1) "1"
+
+--lowercase false--
+bool(false)
+bool(false)
+
+--uppercase TRUE--
+string(1) "1"
+string(1) "1"
+
+--uppercase FALSE--
+bool(false)
+bool(false)
+
+--empty string DQ--
+bool(false)
+bool(false)
+
+--empty string SQ--
+bool(false)
+bool(false)
+
+--instance of classWithToString--
+string(14) "Class A object"
+string(14) "Class A object"
+
+--instance of classWithoutToString--
+
+Warning: gmstrftime() expects parameter 1 to be string, object given in %s on line %d
+bool(false)
+
+Warning: gmstrftime() expects parameter 1 to be string, object given in %s on line %d
+bool(false)
+
+--undefined var--
+bool(false)
+bool(false)
+
+--unset var--
+bool(false)
+bool(false)
+===DONE===
diff --git a/ext/date/tests/gmstrftime_variation10.phpt b/ext/date/tests/gmstrftime_variation10.phpt
new file mode 100644
index 000000000..0e54d846e
--- /dev/null
+++ b/ext/date/tests/gmstrftime_variation10.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Test gmstrftime() function : usage variation - Checking week related formats which are supported other than on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
+ die("skip Test is not valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string gmstrftime(string format [, int timestamp])
+ * Description: Format a GMT/UCT time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmstrftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+
+//array of values to iterate over
+$inputs = array(
+ 'The ISO 8601:1988 week number' => "%V",
+ 'Weekday as decimal' => "%u",
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmstrftime($value) );
+ var_dump( gmstrftime($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmstrftime() : usage variation ***
+
+--The ISO 8601:1988 week number--
+string(%d) "%d"
+string(2) "32"
+
+--Weekday as decimal--
+string(%d) "%d"
+string(1) "5"
+===DONE===
diff --git a/ext/date/tests/gmstrftime_variation11.phpt b/ext/date/tests/gmstrftime_variation11.phpt
new file mode 100644
index 000000000..482ff6d2d
--- /dev/null
+++ b/ext/date/tests/gmstrftime_variation11.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test gmstrftime() function : usage variation - Checking month related formats which are not supported on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
+ die("skip Test is valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string gmstrftime(string format [, int timestamp])
+ * Description: Format a GMT/UCT time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmstrftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+
+echo "\n-- Testing gmstrftime() function with Abbreviated month name format %h --\n";
+$format = "%h";
+var_dump( gmstrftime($format) );
+var_dump( gmstrftime($format, $timestamp) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmstrftime() : usage variation ***
+
+-- Testing gmstrftime() function with Abbreviated month name format %h --
+bool(false)
+bool(false)
+===DONE===
diff --git a/ext/date/tests/gmstrftime_variation12.phpt b/ext/date/tests/gmstrftime_variation12.phpt
new file mode 100644
index 000000000..2c25af6e2
--- /dev/null
+++ b/ext/date/tests/gmstrftime_variation12.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test gmstrftime() function : usage variation - Checking month related formats which are supported other than on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
+ die("skip Test is not valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string gmstrftime(string format [, int timestamp])
+ * Description: Format a GMT/UCT time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmstrftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+
+echo "\n-- Testing gmstrftime() function with Abbreviated month name format %h --\n";
+$format = "%h";
+var_dump( gmstrftime($format) );
+var_dump( gmstrftime($format, $timestamp) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmstrftime() : usage variation ***
+
+-- Testing gmstrftime() function with Abbreviated month name format %h --
+string(%d) "%s"
+string(3) "Aug"
+===DONE===
diff --git a/ext/date/tests/gmstrftime_variation13.phpt b/ext/date/tests/gmstrftime_variation13.phpt
new file mode 100644
index 000000000..42f33f01e
--- /dev/null
+++ b/ext/date/tests/gmstrftime_variation13.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test gmstrftime() function : usage variation - Checking date related formats which are not supported on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
+ die("skip Test is valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string gmstrftime(string format [, int timestamp])
+ * Description: Format a GMT/UCT time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmstrftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+
+//array of values to iterate over
+$inputs = array(
+ 'Century number' => "%C",
+ 'Month Date Year' => "%D",
+ 'Year with century' => "%G",
+ 'Year without century' => "%g",
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmstrftime($value) );
+ var_dump( gmstrftime($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmstrftime() : usage variation ***
+
+--Century number--
+bool(false)
+bool(false)
+
+--Month Date Year--
+bool(false)
+bool(false)
+
+--Year with century--
+bool(false)
+bool(false)
+
+--Year without century--
+bool(false)
+bool(false)
+===DONE===
diff --git a/ext/date/tests/gmstrftime_variation14.phpt b/ext/date/tests/gmstrftime_variation14.phpt
new file mode 100644
index 000000000..880b4330c
--- /dev/null
+++ b/ext/date/tests/gmstrftime_variation14.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test gmstrftime() function : usage variation - Checking date related formats which are supported other than on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
+ die("skip Test is not valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string gmstrftime(string format [, int timestamp])
+ * Description: Format a GMT/UCT time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmstrftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+
+//array of values to iterate over
+$inputs = array(
+ 'Century number' => "%C",
+ 'Month Date Year' => "%D",
+ 'Year with century' => "%G",
+ 'Year without century' => "%g",
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmstrftime($value) );
+ var_dump( gmstrftime($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmstrftime() : usage variation ***
+
+--Century number--
+string(%d) "%d"
+string(2) "20"
+
+--Month Date Year--
+string(%d) "%d/%d/%d"
+string(8) "08/08/08"
+
+--Year with century--
+string(%d) "%d"
+string(4) "2008"
+
+--Year without century--
+string(%d) "%d"
+string(2) "08"
+===DONE===
diff --git a/ext/date/tests/gmstrftime_variation15.phpt b/ext/date/tests/gmstrftime_variation15.phpt
new file mode 100644
index 000000000..c0df36478
--- /dev/null
+++ b/ext/date/tests/gmstrftime_variation15.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test gmstrftime() function : usage variation - Checking time related formats which are not supported on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
+ die("skip Test is valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string gmstrftime(string format [, int timestamp])
+ * Description: Format a GMT/UCT time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmstrftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+
+//array of values to iterate over
+$inputs = array(
+ 'Time in a.m/p.m notation' => "%r",
+ 'Time in 24 hour notation' => "%R",
+ 'Current time %H:%M:%S format' => "%T",
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmstrftime($value) );
+ var_dump( gmstrftime($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmstrftime() : usage variation ***
+
+--Time in a.m/p.m notation--
+bool(false)
+bool(false)
+
+--Time in 24 hour notation--
+bool(false)
+bool(false)
+
+--Current time %H:%M:%S format--
+bool(false)
+bool(false)
+===DONE===
diff --git a/ext/date/tests/gmstrftime_variation16.phpt b/ext/date/tests/gmstrftime_variation16.phpt
new file mode 100644
index 000000000..fd9f809ea
--- /dev/null
+++ b/ext/date/tests/gmstrftime_variation16.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test gmstrftime() function : usage variation - Checking time related formats which are supported other than on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
+ die("skip Test is not valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string gmstrftime(string format [, int timestamp])
+ * Description: Format a GMT/UCT time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmstrftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$timestamp = gmmktime(14, 8, 8, 8, 8, 2008);
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+
+//array of values to iterate over
+$inputs = array(
+ 'Time in a.m/p.m notation' => "%r",
+ 'Time in 24 hour notation' => "%R",
+ 'Current time %H:%M:%S format' => "%T",
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmstrftime($value) );
+ var_dump( gmstrftime($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmstrftime() : usage variation ***
+
+--Time in a.m/p.m notation--
+string(%d) "%d:%d:%d %s"
+string(11) "02:08:08 PM"
+
+--Time in 24 hour notation--
+string(%d) "%d:%d"
+string(5) "14:08"
+
+--Current time %H:%M:%S format--
+string(%d) "%d:%d:%d"
+string(8) "14:08:08"
+===DONE===
diff --git a/ext/date/tests/gmstrftime_variation17.phpt b/ext/date/tests/gmstrftime_variation17.phpt
new file mode 100644
index 000000000..e3070a514
--- /dev/null
+++ b/ext/date/tests/gmstrftime_variation17.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test gmstrftime() function : usage variation - Checking day related formats which are not supported on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
+ die("skip Test is valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string gmstrftime(string format [, int timestamp])
+ * Description: Format a GMT/UCT time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmstrftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+
+echo "\n-- Testing gmstrftime() function with Day of the month as decimal single digit format --\n";
+$format = "%e";
+var_dump( gmstrftime($format) );
+var_dump( gmstrftime($format, $timestamp) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmstrftime() : usage variation ***
+
+-- Testing gmstrftime() function with Day of the month as decimal single digit format --
+bool(false)
+bool(false)
+===DONE===
diff --git a/ext/date/tests/gmstrftime_variation18.phpt b/ext/date/tests/gmstrftime_variation18.phpt
new file mode 100644
index 000000000..b8563dcd2
--- /dev/null
+++ b/ext/date/tests/gmstrftime_variation18.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test gmstrftime() function : usage variation - Checking day related formats which are supported other than on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
+ die("skip Test is not valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string gmstrftime(string format [, int timestamp])
+ * Description: Format a GMT/UCT time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmstrftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+
+echo "\n-- Testing gmstrftime() function with Day of the month as decimal single digit format --\n";
+$format = "%e";
+var_dump( gmstrftime($format) );
+var_dump( gmstrftime($format, $timestamp) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmstrftime() : usage variation ***
+
+-- Testing gmstrftime() function with Day of the month as decimal single digit format --
+string(2) "%s"
+string(2) " 8"
+===DONE===
diff --git a/ext/date/tests/gmstrftime_variation19.phpt b/ext/date/tests/gmstrftime_variation19.phpt
new file mode 100644
index 000000000..3131e01ca
--- /dev/null
+++ b/ext/date/tests/gmstrftime_variation19.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Test gmstrftime() function : usage variation - Checking newline and tab formats which are not supported on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
+ die("skip Test is valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string gmstrftime(string format [, int timestamp])
+ * Description: Format a GMT/UCT time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmstrftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+
+//array of values to iterate over
+$inputs = array(
+ 'Newline character' => "%n",
+ 'Tab character' => "%t"
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmstrftime($value) );
+ var_dump( gmstrftime($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmstrftime() : usage variation ***
+
+--Newline character--
+bool(false)
+bool(false)
+
+--Tab character--
+bool(false)
+bool(false)
+===DONE===
diff --git a/ext/date/tests/gmstrftime_variation2.phpt b/ext/date/tests/gmstrftime_variation2.phpt
new file mode 100644
index 000000000..ee2cecb46
--- /dev/null
+++ b/ext/date/tests/gmstrftime_variation2.phpt
@@ -0,0 +1,202 @@
+--TEST--
+Test gmstrftime() function : usage variation - Passing unexpected values to second argument 'timestamp'.
+--SKIPIF--
+<?php
+if(PHP_INT_SIZE != 4 ) {
+ die("skip Test is not valid for 64-bit");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string gmstrftime(string format [, int timestamp])
+ * Description: Format a GMT/UCT time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmstrftime() : usage variation ***\n";
+
+date_default_timezone_set("Asia/Calcutta");
+
+// Initialise function arguments not being substituted (if any)
+$format = '%b %d %Y %H:%M:%S';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmstrftime($format, $value) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmstrftime() : usage variation ***
+
+--float 10.5--
+string(20) "Jan 01 1970 00:00:10"
+
+--float -10.5--
+string(20) "Dec 31 1969 23:59:50"
+
+--float 12.3456789000e10--
+string(20) "Mar 26 1935 04:50:16"
+
+--float .5--
+string(20) "Jan 01 1970 00:00:00"
+
+--empty array--
+
+Warning: gmstrftime() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: gmstrftime() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: gmstrftime() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: gmstrftime() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+string(20) "Jan 01 1970 00:00:00"
+
+--lowercase null--
+string(20) "Jan 01 1970 00:00:00"
+
+--lowercase true--
+string(20) "Jan 01 1970 00:00:01"
+
+--lowercase false--
+string(20) "Jan 01 1970 00:00:00"
+
+--uppercase TRUE--
+string(20) "Jan 01 1970 00:00:01"
+
+--uppercase FALSE--
+string(20) "Jan 01 1970 00:00:00"
+
+--empty string DQ--
+
+Warning: gmstrftime() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: gmstrftime() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--string DQ--
+
+Warning: gmstrftime() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--string SQ--
+
+Warning: gmstrftime() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--mixed case string--
+
+Warning: gmstrftime() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--heredoc--
+
+Warning: gmstrftime() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: gmstrftime() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: gmstrftime() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+
+--undefined var--
+string(20) "Jan 01 1970 00:00:00"
+
+--unset var--
+string(20) "Jan 01 1970 00:00:00"
+===DONE===
diff --git a/ext/date/tests/gmstrftime_variation20.phpt b/ext/date/tests/gmstrftime_variation20.phpt
new file mode 100644
index 000000000..a8898d8ec
--- /dev/null
+++ b/ext/date/tests/gmstrftime_variation20.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Test gmstrftime() function : usage variation - Checking newline and tab formats which are supported other than on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
+ die("skip Test is not valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string gmstrftime(string format [, int timestamp])
+ * Description: Format a GMT/UCT time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmstrftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+
+//array of values to iterate over
+$inputs = array(
+ 'Newline character' => "%n",
+ 'Tab character' => "%t"
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmstrftime($value) );
+ var_dump( gmstrftime($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECTREGEX--
+\*\*\* Testing gmstrftime\(\) : usage variation \*\*\*
+
+--Newline character--
+string\(1\) "
+"
+string\(1\) "
+"
+
+--Tab character--
+string\(1\) "\s"
+string\(1\) "\s"
+===DONE===
diff --git a/ext/date/tests/gmstrftime_variation21.phpt b/ext/date/tests/gmstrftime_variation21.phpt
new file mode 100644
index 000000000..fb53cb695
--- /dev/null
+++ b/ext/date/tests/gmstrftime_variation21.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test gmstrftime() function : usage variation - Checking Preferred date and time representation on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
+ die("skip Test is only valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string gmstrftime(string format [, int timestamp])
+ * Description: Format a GMT/UCT time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmstrftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+
+//array of values to iterate over
+$inputs = array(
+ 'Preferred date and time representation' => "%c",
+ 'Preferred date representation' => "%x",
+ 'Preferred time representation' => "%X",
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmstrftime($value) );
+ var_dump( gmstrftime($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmstrftime() : usage variation ***
+
+--Preferred date and time representation--
+string(%d) "%d/%d/%d %d:%d:%d"
+string(17) "08/08/08 08:08:08"
+
+--Preferred date representation--
+string(%d) "%d/%d/%d"
+string(8) "08/08/08"
+
+--Preferred time representation--
+string(%d) "%d:%d:%d"
+string(8) "08:08:08"
+===DONE===
diff --git a/ext/date/tests/gmstrftime_variation22.phpt b/ext/date/tests/gmstrftime_variation22.phpt
new file mode 100644
index 000000000..213fa5c74
--- /dev/null
+++ b/ext/date/tests/gmstrftime_variation22.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test gmstrftime() function : usage variation - Checking Preferred date and time representation other than on Windows
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
+ die("skip Test is not valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string gmstrftime(string format [, int timestamp])
+ * Description: Format a GMT/UCT time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmstrftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+
+//array of values to iterate over
+$inputs = array(
+ 'Preferred date and time representation' => "%c",
+ 'Preferred date representation' => "%x",
+ 'Preferred time representation' => "%X",
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmstrftime($value) );
+ var_dump( gmstrftime($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmstrftime() : usage variation ***
+
+--Preferred date and time representation--
+string(%d) "%s %d %s %d %d:%d:%d %s GMT"
+string(31) "Fri 08 Aug 2008 08:08:08 AM GMT"
+
+--Preferred date representation--
+string(%d) "%d/%d/%d"
+string(10) "08/08/2008"
+
+--Preferred time representation--
+string(%d) "%d:%d:%d %s"
+string(11) "08:08:08 AM"
+===DONE===
diff --git a/ext/date/tests/gmstrftime_variation3.phpt b/ext/date/tests/gmstrftime_variation3.phpt
new file mode 100644
index 000000000..bc05c7b4c
--- /dev/null
+++ b/ext/date/tests/gmstrftime_variation3.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Test gmstrftime() function : usage variation - Passing week related format strings to format argument.
+--FILE--
+<?php
+/* Prototype : string gmstrftime(string format [, int timestamp])
+ * Description: Format a GMT/UCT time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmstrftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
+
+//array of values to iterate over
+$inputs = array(
+ 'Abbreviated weekday name' => "%a",
+ 'Full weekday name' => "%A",
+ 'Week number of the year' => "%U",
+ 'Week number of the year in decimal number' => "%W",
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmstrftime($value) );
+ var_dump( gmstrftime($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmstrftime() : usage variation ***
+
+--Abbreviated weekday name--
+string(%d) "%s"
+string(3) "Fri"
+
+--Full weekday name--
+string(%d) "%s"
+string(6) "Friday"
+
+--Week number of the year--
+string(%d) "%d"
+string(2) "31"
+
+--Week number of the year in decimal number--
+string(%d) "%d"
+string(2) "31"
+===DONE===
diff --git a/ext/date/tests/gmstrftime_variation4.phpt b/ext/date/tests/gmstrftime_variation4.phpt
new file mode 100644
index 000000000..619e633a9
--- /dev/null
+++ b/ext/date/tests/gmstrftime_variation4.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test gmstrftime() function : usage variation - Passing month related format strings to format argument.
+--FILE--
+<?php
+/* Prototype : string gmstrftime(string format [, int timestamp])
+ * Description: Format a GMT/UCT time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmstrftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
+
+//array of values to iterate over
+$inputs = array(
+ 'Abbreviated month name' => "%b",
+ 'Full month name' => "%B",
+ 'Month as decimal' => "%m",
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmstrftime($value) );
+ var_dump( gmstrftime($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmstrftime() : usage variation ***
+
+--Abbreviated month name--
+string(%d) "%s"
+string(3) "Aug"
+
+--Full month name--
+string(%d) "%s"
+string(6) "August"
+
+--Month as decimal--
+string(%d) "%d"
+string(2) "08"
+===DONE===
diff --git a/ext/date/tests/gmstrftime_variation5.phpt b/ext/date/tests/gmstrftime_variation5.phpt
new file mode 100644
index 000000000..95e3bd239
--- /dev/null
+++ b/ext/date/tests/gmstrftime_variation5.phpt
@@ -0,0 +1,51 @@
+--TEST--
+Test gmstrftime() function : usage variation - Passing date related format strings to format argument.
+--FILE--
+<?php
+/* Prototype : string gmstrftime(string format [, int timestamp])
+ * Description: Format a GMT/UCT time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmstrftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+
+
+//array of values to iterate over
+$inputs = array(
+ 'Year as decimal number without a century' => "%y",
+ 'Year as decimal number including the century' => "%Y",
+ 'Time zone offset' => "%Z",
+ 'Time zone offset' => "%z",
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmstrftime($value) );
+ var_dump( gmstrftime($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmstrftime() : usage variation ***
+
+--Year as decimal number without a century--
+string(%d) "%d"
+string(2) "08"
+
+--Year as decimal number including the century--
+string(%d) "%d"
+string(4) "2008"
+
+--Time zone offset--
+string(%s) "%s"
+string(%s) "%s"
+===DONE===
diff --git a/ext/date/tests/gmstrftime_variation6.phpt b/ext/date/tests/gmstrftime_variation6.phpt
new file mode 100644
index 000000000..92dd1ede3
--- /dev/null
+++ b/ext/date/tests/gmstrftime_variation6.phpt
@@ -0,0 +1,59 @@
+--TEST--
+Test gmstrftime() function : usage variation - Passing time related format strings to format argument.
+--FILE--
+<?php
+/* Prototype : string gmstrftime(string format [, int timestamp])
+ * Description: Format a GMT/UCT time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmstrftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+
+//array of values to iterate over
+$inputs = array(
+ 'Hour as decimal by 24-hour format' => "%H",
+ 'Hour as decimal by 12-hour format' => "%I",
+ 'Minute as decimal number' => "%M",
+ 'AM/PM format for a time' => "%p",
+ 'Second as decimal number' => "%S",
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmstrftime($value) );
+ var_dump( gmstrftime($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmstrftime() : usage variation ***
+
+--Hour as decimal by 24-hour format--
+string(2) "%d"
+string(2) "08"
+
+--Hour as decimal by 12-hour format--
+string(2) "%d"
+string(2) "08"
+
+--Minute as decimal number--
+string(%d) "%d"
+string(2) "08"
+
+--AM/PM format for a time--
+string(2) "%s"
+string(2) "AM"
+
+--Second as decimal number--
+string(%d) "%d"
+string(2) "08"
+===DONE===
diff --git a/ext/date/tests/gmstrftime_variation7.phpt b/ext/date/tests/gmstrftime_variation7.phpt
new file mode 100644
index 000000000..dd0584b70
--- /dev/null
+++ b/ext/date/tests/gmstrftime_variation7.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Test gmstrftime() function : usage variation - Passing day related format strings to format argument.
+--FILE--
+<?php
+/* Prototype : string gmstrftime(string format [, int timestamp])
+ * Description: Format a GMT/UCT time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmstrftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+
+//array of values to iterate over
+$inputs = array(
+ 'Day of the month as a decimal number' => "%d",
+ 'Day of the year as a decimal number' => "%j",
+ 'Day of the week as a decimal number' => "%w"
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmstrftime($value) );
+ var_dump( gmstrftime($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmstrftime() : usage variation ***
+
+--Day of the month as a decimal number--
+string(%d) "%d"
+string(2) "08"
+
+--Day of the year as a decimal number--
+string(%d) "%d"
+string(3) "221"
+
+--Day of the week as a decimal number--
+string(%d) "%d"
+string(1) "5"
+===DONE===
diff --git a/ext/date/tests/gmstrftime_variation8.phpt b/ext/date/tests/gmstrftime_variation8.phpt
new file mode 100644
index 000000000..59057aa17
--- /dev/null
+++ b/ext/date/tests/gmstrftime_variation8.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test gmstrftime() function : usage variation - Passing literal related strings to format argument.
+--FILE--
+<?php
+/* Prototype : string gmstrftime(string format [, int timestamp])
+ * Description: Format a GMT/UCT time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmstrftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+
+//array of values to iterate over
+$inputs = array(
+ 'A literal % character' => "%%",
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmstrftime($value) );
+ var_dump( gmstrftime($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmstrftime() : usage variation ***
+
+--A literal % character--
+string(1) "%"
+string(1) "%"
+===DONE===
diff --git a/ext/date/tests/gmstrftime_variation9.phpt b/ext/date/tests/gmstrftime_variation9.phpt
new file mode 100644
index 000000000..c9c93fc10
--- /dev/null
+++ b/ext/date/tests/gmstrftime_variation9.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Test gmstrftime() function : usage variation - Checking week related formats which are not supported on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
+ die("skip Test is valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string gmstrftime(string format [, int timestamp])
+ * Description: Format a GMT/UCT time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmstrftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+
+//array of values to iterate over
+$inputs = array(
+ 'The ISO 8601:1988 week number' => "%V",
+ 'Weekday as decimal' => "%u",
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmstrftime($value) );
+ var_dump( gmstrftime($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmstrftime() : usage variation ***
+
+--The ISO 8601:1988 week number--
+bool(false)
+bool(false)
+
+--Weekday as decimal--
+bool(false)
+bool(false)
+===DONE===
diff --git a/ext/date/tests/idate_basic.phpt b/ext/date/tests/idate_basic.phpt
new file mode 100644
index 000000000..944f29f5b
--- /dev/null
+++ b/ext/date/tests/idate_basic.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Test idate() function : basic functionality
+--FILE--
+<?php
+/* Prototype : int idate(string format [, int timestamp])
+ * Description: Format a local time/date as integer
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing idate() : basic functionality ***\n";
+
+// Initialise all required variables
+$format = 'Y';
+
+// Calling idate() with mandatory arguments
+date_default_timezone_set("Asia/Calcutta");
+var_dump( idate($format) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing idate() : basic functionality ***
+int(%d)
+===DONE===
diff --git a/ext/date/tests/idate_variation1.phpt b/ext/date/tests/idate_variation1.phpt
new file mode 100644
index 000000000..c0231a6c0
--- /dev/null
+++ b/ext/date/tests/idate_variation1.phpt
@@ -0,0 +1,301 @@
+--TEST--
+Test idate() function : usage variation - Passing unexpected values to first argument 'format'.
+--FILE--
+<?php
+/* Prototype : int idate(string format [, int timestamp])
+ * Description: Format a local time/date as integer
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing idate() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+date_default_timezone_set("Asia/Calcutta");
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for format
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( idate($value) );
+ var_dump( idate($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing idate() : usage variation ***
+
+--int 0--
+
+Warning: idate(): Unrecognized date format token. in %s on line %d
+bool(false)
+
+Warning: idate(): Unrecognized date format token. in %s on line %d
+bool(false)
+
+--int 1--
+
+Warning: idate(): Unrecognized date format token. in %s on line %d
+bool(false)
+
+Warning: idate(): Unrecognized date format token. in %s on line %d
+bool(false)
+
+--int 12345--
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+--int -12345--
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+--float 10.5--
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+--float -10.5--
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+--float 12.3456789000e10--
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+--float -12.3456789000e10--
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+--float .5--
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+--empty array--
+
+Warning: idate() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+Warning: idate() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: idate() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+Warning: idate() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: idate() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+Warning: idate() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: idate() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+Warning: idate() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+--lowercase null--
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+--lowercase true--
+
+Warning: idate(): Unrecognized date format token. in %s on line %d
+bool(false)
+
+Warning: idate(): Unrecognized date format token. in %s on line %d
+bool(false)
+
+--lowercase false--
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+--uppercase TRUE--
+
+Warning: idate(): Unrecognized date format token. in %s on line %d
+bool(false)
+
+Warning: idate(): Unrecognized date format token. in %s on line %d
+bool(false)
+
+--uppercase FALSE--
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+--empty string DQ--
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: idate() expects parameter 1 to be string, object given in %s on line %d
+bool(false)
+
+Warning: idate() expects parameter 1 to be string, object given in %s on line %d
+bool(false)
+
+--undefined var--
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+--unset var--
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/idate_variation2.phpt b/ext/date/tests/idate_variation2.phpt
new file mode 100644
index 000000000..7dd761d51
--- /dev/null
+++ b/ext/date/tests/idate_variation2.phpt
@@ -0,0 +1,191 @@
+--TEST--
+Test idate() function : usage variation - Passing unexpected values to second optional argument 'timestamp'.
+--FILE--
+<?php
+/* Prototype : int idate(string format [, int timestamp])
+ * Description: Format a local time/date as integer
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing idate() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$format = 'Y';
+date_default_timezone_set("Asia/Calcutta");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( idate($format, $value) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing idate() : usage variation ***
+
+--float 10.5--
+int(1970)
+
+--float -10.5--
+int(1970)
+
+--float .5--
+int(1970)
+
+--empty array--
+
+Warning: idate() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: idate() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: idate() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: idate() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+int(1970)
+
+--lowercase null--
+int(1970)
+
+--lowercase true--
+int(1970)
+
+--lowercase false--
+int(1970)
+
+--uppercase TRUE--
+int(1970)
+
+--uppercase FALSE--
+int(1970)
+
+--empty string DQ--
+
+Warning: idate() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: idate() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--string DQ--
+
+Warning: idate() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--string SQ--
+
+Warning: idate() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--mixed case string--
+
+Warning: idate() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--heredoc--
+
+Warning: idate() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: idate() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: idate() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+
+--undefined var--
+int(1970)
+
+--unset var--
+int(1970)
+===DONE===
diff --git a/ext/date/tests/idate_variation3.phpt b/ext/date/tests/idate_variation3.phpt
new file mode 100644
index 000000000..1a2ee1ffd
--- /dev/null
+++ b/ext/date/tests/idate_variation3.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test idate() function : usage variation - Passing higher positive and negetive float values to timestamp.
+--FILE--
+<?php
+/* Prototype : int idate(string format [, int timestamp])
+ * Description: Format a local time/date as integer
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing idate() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$format = 'Y';
+date_default_timezone_set("Asia/Calcutta");
+
+echo "\n-- Testing idate() function with float 12.3456789000e10 to timestamp --\n";
+$timestamp = 12.3456789000e10;
+var_dump( idate($format, $timestamp) );
+
+echo "\n-- Testing idate() function with float -12.3456789000e10 to timestamp --\n";
+$timestamp = -12.3456789000e10;
+var_dump( idate($format, $timestamp) );
+
+?>
+===DONE===
+--EXPECTREGEX--
+\*\*\* Testing idate\(\) : usage variation \*\*\*
+
+-- Testing idate\(\) function with float 12.3456789000e10 to timestamp --
+int\((1935|5882)\)
+
+-- Testing idate\(\) function with float -12.3456789000e10 to timestamp --
+int\((2004|1901|-1943)\)
+===DONE===
diff --git a/ext/date/tests/idate_variation4.phpt b/ext/date/tests/idate_variation4.phpt
new file mode 100644
index 000000000..6aa1735df
--- /dev/null
+++ b/ext/date/tests/idate_variation4.phpt
@@ -0,0 +1,66 @@
+--TEST--
+Test idate() function : usage variation - Passing supported Date format characters to format argument.
+--FILE--
+<?php
+/* Prototype : int idate(string format [, int timestamp])
+ * Description: Format a local time/date as integer
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing idate() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+date_default_timezone_set("Asia/Calcutta");
+
+//array of values to iterate over
+$inputs = array(
+
+ 'Day of the month' => 'd',
+ 'Leap Year' =>'L',
+ 'Month number' => 'm',
+ 'Days in the month' => 't',
+ 'Day of the week' => 'w',
+ 'ISO-8601 week number' => 'W',
+ 'Year (1 or 2 digits)' => 'y',
+ 'Year 4 digits' => 'Y',
+ 'Day of the year' => 'z',
+);
+
+// loop through each element of the array for timestamp
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( idate($value) );
+};
+?>
+===DONE===
+--EXPECTF--
+*** Testing idate() : usage variation ***
+
+--Day of the month--
+int(%d)
+
+--Leap Year--
+int(%d)
+
+--Month number--
+int(%d)
+
+--Days in the month--
+int(%d)
+
+--Day of the week--
+int(%d)
+
+--ISO-8601 week number--
+int(%d)
+
+--Year (1 or 2 digits)--
+int(%d)
+
+--Year 4 digits--
+int(%d)
+
+--Day of the year--
+int(%d)
+===DONE===
diff --git a/ext/date/tests/idate_variation5.phpt b/ext/date/tests/idate_variation5.phpt
new file mode 100644
index 000000000..e70509c59
--- /dev/null
+++ b/ext/date/tests/idate_variation5.phpt
@@ -0,0 +1,62 @@
+--TEST--
+Test idate() function : usage variation - Passing supported Time format characters to format argument.
+--FILE--
+<?php
+/* Prototype : int idate(string format [, int timestamp])
+ * Description: Format a local time/date as integer
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing idate() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+date_default_timezone_set("Asia/Calcutta");
+
+//array of values to iterate over
+$inputs = array(
+
+ 'Internet Time' => 'B',
+ '12 hour format' => 'h',
+ '24 hour format' => 'H',
+ 'Minutes' => 'i',
+ 'DST Activated' => 'I',
+ 'Seconds' => 's',
+ 'Seconds since Unix Epoch' => 'U',
+ 'Time zone offset' => 'Z'
+);
+
+// loop through each element of the array for timestamp
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( idate($value) );
+};
+?>
+===DONE===
+--EXPECTF--
+*** Testing idate() : usage variation ***
+
+--Internet Time--
+int(%d)
+
+--12 hour format--
+int(%d)
+
+--24 hour format--
+int(%d)
+
+--Minutes--
+int(%d)
+
+--DST Activated--
+int(%d)
+
+--Seconds--
+int(%d)
+
+--Seconds since Unix Epoch--
+int(%d)
+
+--Time zone offset--
+int(%d)
+===DONE===
diff --git a/ext/date/tests/idate_variation6.phpt b/ext/date/tests/idate_variation6.phpt
new file mode 100644
index 000000000..161a80d51
--- /dev/null
+++ b/ext/date/tests/idate_variation6.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test idate() function : usage variation - Checking return of year(1 or 2 digits) format starting with zero and nonzero.
+--FILE--
+<?php
+/* Prototype : int idate(string format [, int timestamp])
+ * Description: Format a local time/date as integer
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing idate() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+date_default_timezone_set("Asia/Calcutta");
+$format = 'y';
+
+echo "\n-- Testing idate() function for 2 digit year having no zero as starting number --\n";
+$timestamp = mktime(8, 8, 8, 8, 8, 1970);
+var_dump( idate($format, $timestamp) );
+
+echo "\n-- Testing idate() function for 2 digit year having zero as starting number --\n";
+$timestamp = mktime(8, 8, 8, 8, 8, 2001);
+var_dump( idate($format, $timestamp) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing idate() : usage variation ***
+
+-- Testing idate() function for 2 digit year having no zero as starting number --
+int(70)
+
+-- Testing idate() function for 2 digit year having zero as starting number --
+int(1)
+===DONE===
diff --git a/ext/date/tests/localtime_basic.phpt b/ext/date/tests/localtime_basic.phpt
new file mode 100644
index 000000000..fcfd636fb
--- /dev/null
+++ b/ext/date/tests/localtime_basic.phpt
@@ -0,0 +1,93 @@
+--TEST--
+Test localtime() function : basic functionality
+--FILE--
+<?php
+/* Prototype : array localtime([int timestamp [, bool associative_array]])
+ * Description: Returns the results of the C system call localtime as an associative array
+ * if the associative_array argument is set to 1 other wise it is a regular array
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing localtime() : basic functionality ***\n";
+
+date_default_timezone_set("UTC");
+
+// Initialise all required variables
+$timestamp = 10;
+$associative_array = true;
+
+// Calling localtime() with all possible arguments
+var_dump( localtime($timestamp, $associative_array) );
+
+// Calling localtime() with possible optional arguments
+var_dump( localtime($timestamp) );
+
+// Calling localtime() with mandatory arguments
+var_dump( localtime() );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing localtime() : basic functionality ***
+array(9) {
+ ["tm_sec"]=>
+ int(10)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+array(9) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ [4]=>
+ int(0)
+ [5]=>
+ int(70)
+ [6]=>
+ int(4)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+}
+array(9) {
+ [0]=>
+ int(%d)
+ [1]=>
+ int(%d)
+ [2]=>
+ int(%d)
+ [3]=>
+ int(%d)
+ [4]=>
+ int(%d)
+ [5]=>
+ int(%d)
+ [6]=>
+ int(%d)
+ [7]=>
+ int(%d)
+ [8]=>
+ int(%d)
+}
+===DONE===
diff --git a/ext/date/tests/localtime_variation1.phpt b/ext/date/tests/localtime_variation1.phpt
new file mode 100644
index 000000000..472b32b60
--- /dev/null
+++ b/ext/date/tests/localtime_variation1.phpt
@@ -0,0 +1,658 @@
+--TEST--
+Test localtime() function : usage variation - Passing unexpected values to first argument 'timestamp'.
+--FILE--
+<?php
+/* Prototype : array localtime([int timestamp [, bool associative_array]])
+ * Description: Returns the results of the C system call localtime as an associative array
+ * if the associative_array argument is set to 1 other wise it is a regular array
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing localtime() : usage variation ***\n";
+
+date_default_timezone_set("UTC");
+// Initialise function arguments not being substituted (if any)
+$is_associative = true;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( localtime($value) );
+ var_dump( localtime($value, $is_associative) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing localtime() : usage variation ***
+
+--float 10.5--
+array(9) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ [4]=>
+ int(0)
+ [5]=>
+ int(70)
+ [6]=>
+ int(4)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+}
+array(9) {
+ ["tm_sec"]=>
+ int(10)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--float -10.5--
+array(9) {
+ [0]=>
+ int(50)
+ [1]=>
+ int(59)
+ [2]=>
+ int(23)
+ [3]=>
+ int(31)
+ [4]=>
+ int(11)
+ [5]=>
+ int(69)
+ [6]=>
+ int(3)
+ [7]=>
+ int(364)
+ [8]=>
+ int(0)
+}
+array(9) {
+ ["tm_sec"]=>
+ int(50)
+ ["tm_min"]=>
+ int(59)
+ ["tm_hour"]=>
+ int(23)
+ ["tm_mday"]=>
+ int(31)
+ ["tm_mon"]=>
+ int(11)
+ ["tm_year"]=>
+ int(69)
+ ["tm_wday"]=>
+ int(3)
+ ["tm_yday"]=>
+ int(364)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--float .5--
+array(9) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ [4]=>
+ int(0)
+ [5]=>
+ int(70)
+ [6]=>
+ int(4)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+}
+array(9) {
+ ["tm_sec"]=>
+ int(0)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--empty array--
+
+Warning: localtime() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Warning: localtime() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: localtime() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Warning: localtime() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: localtime() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Warning: localtime() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: localtime() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Warning: localtime() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+array(9) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ [4]=>
+ int(0)
+ [5]=>
+ int(70)
+ [6]=>
+ int(4)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+}
+array(9) {
+ ["tm_sec"]=>
+ int(0)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--lowercase null--
+array(9) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ [4]=>
+ int(0)
+ [5]=>
+ int(70)
+ [6]=>
+ int(4)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+}
+array(9) {
+ ["tm_sec"]=>
+ int(0)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--lowercase true--
+array(9) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ [4]=>
+ int(0)
+ [5]=>
+ int(70)
+ [6]=>
+ int(4)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+}
+array(9) {
+ ["tm_sec"]=>
+ int(1)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--lowercase false--
+array(9) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ [4]=>
+ int(0)
+ [5]=>
+ int(70)
+ [6]=>
+ int(4)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+}
+array(9) {
+ ["tm_sec"]=>
+ int(0)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--uppercase TRUE--
+array(9) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ [4]=>
+ int(0)
+ [5]=>
+ int(70)
+ [6]=>
+ int(4)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+}
+array(9) {
+ ["tm_sec"]=>
+ int(1)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--uppercase FALSE--
+array(9) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ [4]=>
+ int(0)
+ [5]=>
+ int(70)
+ [6]=>
+ int(4)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+}
+array(9) {
+ ["tm_sec"]=>
+ int(0)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--empty string DQ--
+
+Warning: localtime() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: localtime() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: localtime() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: localtime() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--string DQ--
+
+Warning: localtime() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: localtime() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--string SQ--
+
+Warning: localtime() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: localtime() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--mixed case string--
+
+Warning: localtime() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: localtime() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--heredoc--
+
+Warning: localtime() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: localtime() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: localtime() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+
+Warning: localtime() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: localtime() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+
+Warning: localtime() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+
+--undefined var--
+array(9) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ [4]=>
+ int(0)
+ [5]=>
+ int(70)
+ [6]=>
+ int(4)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+}
+array(9) {
+ ["tm_sec"]=>
+ int(0)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--unset var--
+array(9) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ [4]=>
+ int(0)
+ [5]=>
+ int(70)
+ [6]=>
+ int(4)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+}
+array(9) {
+ ["tm_sec"]=>
+ int(0)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+===DONE===
diff --git a/ext/date/tests/localtime_variation2.phpt b/ext/date/tests/localtime_variation2.phpt
new file mode 100644
index 000000000..a2048206a
--- /dev/null
+++ b/ext/date/tests/localtime_variation2.phpt
@@ -0,0 +1,643 @@
+--TEST--
+Test localtime() function : usage variation - Passing unexpected values to second argument 'associative_array'.
+--FILE--
+<?php
+/* Prototype : array localtime([int timestamp [, bool associative_array]])
+ * Description: Returns the results of the C system call localtime as an associative array
+ * if the associative_array argument is set to 1 other wise it is a regular array
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing localtime() : usage variation ***\n";
+
+date_default_timezone_set("UTC");
+// Initialise function arguments not being substituted (if any)
+$timestamp = 10;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for associative_array
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( localtime($timestamp, $value) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing localtime() : usage variation ***
+
+--int 0--
+array(9) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ [4]=>
+ int(0)
+ [5]=>
+ int(70)
+ [6]=>
+ int(4)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+}
+
+--int 1--
+array(9) {
+ ["tm_sec"]=>
+ int(10)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--int 12345--
+array(9) {
+ ["tm_sec"]=>
+ int(10)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--int -12345--
+array(9) {
+ ["tm_sec"]=>
+ int(10)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--float 10.5--
+array(9) {
+ ["tm_sec"]=>
+ int(10)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--float -10.5--
+array(9) {
+ ["tm_sec"]=>
+ int(10)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--float 12.3456789000e10--
+array(9) {
+ ["tm_sec"]=>
+ int(10)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--float -12.3456789000e10--
+array(9) {
+ ["tm_sec"]=>
+ int(10)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--float .5--
+array(9) {
+ ["tm_sec"]=>
+ int(10)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--empty array--
+
+Warning: localtime() expects parameter 2 to be boolean, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: localtime() expects parameter 2 to be boolean, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: localtime() expects parameter 2 to be boolean, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: localtime() expects parameter 2 to be boolean, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+array(9) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ [4]=>
+ int(0)
+ [5]=>
+ int(70)
+ [6]=>
+ int(4)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+}
+
+--lowercase null--
+array(9) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ [4]=>
+ int(0)
+ [5]=>
+ int(70)
+ [6]=>
+ int(4)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+}
+
+--lowercase true--
+array(9) {
+ ["tm_sec"]=>
+ int(10)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--lowercase false--
+array(9) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ [4]=>
+ int(0)
+ [5]=>
+ int(70)
+ [6]=>
+ int(4)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+}
+
+--uppercase TRUE--
+array(9) {
+ ["tm_sec"]=>
+ int(10)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--uppercase FALSE--
+array(9) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ [4]=>
+ int(0)
+ [5]=>
+ int(70)
+ [6]=>
+ int(4)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+}
+
+--empty string DQ--
+array(9) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ [4]=>
+ int(0)
+ [5]=>
+ int(70)
+ [6]=>
+ int(4)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+}
+
+--empty string SQ--
+array(9) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ [4]=>
+ int(0)
+ [5]=>
+ int(70)
+ [6]=>
+ int(4)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+}
+
+--string DQ--
+array(9) {
+ ["tm_sec"]=>
+ int(10)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--string SQ--
+array(9) {
+ ["tm_sec"]=>
+ int(10)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--mixed case string--
+array(9) {
+ ["tm_sec"]=>
+ int(10)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--heredoc--
+array(9) {
+ ["tm_sec"]=>
+ int(10)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--instance of classWithToString--
+
+Warning: localtime() expects parameter 2 to be boolean, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: localtime() expects parameter 2 to be boolean, object given in %s on line %d
+bool(false)
+
+--undefined var--
+array(9) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ [4]=>
+ int(0)
+ [5]=>
+ int(70)
+ [6]=>
+ int(4)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+}
+
+--unset var--
+array(9) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ [4]=>
+ int(0)
+ [5]=>
+ int(70)
+ [6]=>
+ int(4)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+}
+===DONE===
diff --git a/ext/date/tests/localtime_variation3.phpt b/ext/date/tests/localtime_variation3.phpt
new file mode 100644
index 000000000..d941e3891
--- /dev/null
+++ b/ext/date/tests/localtime_variation3.phpt
@@ -0,0 +1,116 @@
+--TEST--
+Test localtime() function : usage variation - Passing higher positive and negetive float values to timestamp.
+--FILE--
+<?php
+/* Prototype : array localtime([int timestamp [, bool associative_array]])
+ * Description: Returns the results of the C system call localtime as an associative array
+ * if the associative_array argument is set to 1 other wise it is a regular array
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing localtime() : usage variation ***\n";
+
+date_default_timezone_set("UTC");
+// Initialise function arguments not being substituted (if any)
+$is_associative = true;
+
+echo "\n-- Testing localtime() function with 'float 12.3456789000e10' to timestamp --\n";
+$timestamp = 12.3456789000e10;
+var_dump( localtime($timestamp) );
+var_dump( localtime($timestamp, $is_associative) );
+
+echo "\n-- Testing localtime() function with 'float -12.3456789000e10' to timestamp --\n";
+$timestamp = -12.3456789000e10;
+var_dump( localtime($timestamp) );
+var_dump( localtime($timestamp, $is_associative) );
+
+?>
+===DONE===
+--EXPECTREGEX--
+\*\*\* Testing localtime\(\) : usage variation \*\*\*
+
+-- Testing localtime\(\) function with 'float 12.3456789000e10' to timestamp --
+array\(9\) {
+ \[0\]=>
+ int\((16|0)\)
+ \[1\]=>
+ int\((50|30)\)
+ \[2\]=>
+ int\((4|0)\)
+ \[3\]=>
+ int\((26|11)\)
+ \[4\]=>
+ int\(2\)
+ \[5\]=>
+ int\((35|3982)\)
+ \[6\]=>
+ int\((2|6)\)
+ \[7\]=>
+ int\((84|69)\)
+ \[8\]=>
+ int\(0\)
+}
+array\(9\) {
+ \["tm_sec"\]=>
+ int\((16|0)\)
+ \["tm_min"\]=>
+ int\((50|30)\)
+ \["tm_hour"\]=>
+ int\((4|0)\)
+ \["tm_mday"\]=>
+ int\((26|11)\)
+ \["tm_mon"\]=>
+ int\(2\)
+ \["tm_year"\]=>
+ int\((35|3982)\)
+ \["tm_wday"\]=>
+ int\((2|6)\)
+ \["tm_yday"\]=>
+ int\((84|69)\)
+ \["tm_isdst"\]=>
+ int\(0\)
+}
+
+-- Testing localtime\(\) function with 'float -12.3456789000e10' to timestamp --
+array\(9\) {
+ \[0\]=>
+ int\((44|52|0)\)
+ \[1\]=>
+ int\((9|45|30)\)
+ \[2\]=>
+ int\((19|20|23)\)
+ \[3\]=>
+ int\((8|13|22)\)
+ \[4\]=>
+ int\((9|11)\)
+ \[5\]=>
+ int\((104|1|-3843)\)
+ \[6\]=>
+ int\((5|-5)\)
+ \[7\]=>
+ int\((281|346|294)\)
+ \[8\]=>
+ int\(0\)
+}
+array\(9\) {
+ \["tm_sec"\]=>
+ int\((44|52|0)\)
+ \["tm_min"\]=>
+ int\((9|45|30)\)
+ \["tm_hour"\]=>
+ int\((19|20|23)\)
+ \["tm_mday"\]=>
+ int\((8|13|22)\)
+ \["tm_mon"\]=>
+ int\((9|11)\)
+ \["tm_year"\]=>
+ int\((104|1|-3843)\)
+ \["tm_wday"\]=>
+ int\((5|-5)\)
+ \["tm_yday"\]=>
+ int\((281|346|294)\)
+ \["tm_isdst"\]=>
+ int\(0\)
+}
+===DONE===
diff --git a/ext/date/tests/localtime_variation4.phpt b/ext/date/tests/localtime_variation4.phpt
new file mode 100644
index 000000000..2796c22d5
--- /dev/null
+++ b/ext/date/tests/localtime_variation4.phpt
@@ -0,0 +1,162 @@
+--TEST--
+Test localtime() function : usage variation - Passing octal values to timestamp.
+--FILE--
+<?php
+/* Prototype : array localtime([int timestamp [, bool associative_array]])
+ * Description: Returns the results of the C system call localtime as an associative array
+ * if the associative_array argument is set to 1 other wise it is a regular array
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing localtime() : usage variation ***\n";
+
+date_default_timezone_set("UTC");
+// Initialise function arguments not being substituted (if any)
+$is_associative = true;
+
+//array of values to iterate over
+$inputs = array(
+
+ 'Octal 0' => 00,
+ 'Octal 10' => 012,
+ 'Octal -10' => -012
+);
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( localtime($value) );
+ var_dump( localtime($value, $is_associative) );
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing localtime() : usage variation ***
+
+--Octal 0--
+array(9) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ [4]=>
+ int(0)
+ [5]=>
+ int(70)
+ [6]=>
+ int(4)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+}
+array(9) {
+ ["tm_sec"]=>
+ int(0)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--Octal 10--
+array(9) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ [4]=>
+ int(0)
+ [5]=>
+ int(70)
+ [6]=>
+ int(4)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+}
+array(9) {
+ ["tm_sec"]=>
+ int(10)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--Octal -10--
+array(9) {
+ [0]=>
+ int(50)
+ [1]=>
+ int(59)
+ [2]=>
+ int(23)
+ [3]=>
+ int(31)
+ [4]=>
+ int(11)
+ [5]=>
+ int(69)
+ [6]=>
+ int(3)
+ [7]=>
+ int(364)
+ [8]=>
+ int(0)
+}
+array(9) {
+ ["tm_sec"]=>
+ int(50)
+ ["tm_min"]=>
+ int(59)
+ ["tm_hour"]=>
+ int(23)
+ ["tm_mday"]=>
+ int(31)
+ ["tm_mon"]=>
+ int(11)
+ ["tm_year"]=>
+ int(69)
+ ["tm_wday"]=>
+ int(3)
+ ["tm_yday"]=>
+ int(364)
+ ["tm_isdst"]=>
+ int(0)
+}
+===DONE===
diff --git a/ext/date/tests/localtime_variation5.phpt b/ext/date/tests/localtime_variation5.phpt
new file mode 100644
index 000000000..883e34887
--- /dev/null
+++ b/ext/date/tests/localtime_variation5.phpt
@@ -0,0 +1,162 @@
+--TEST--
+Test localtime() function : usage variation - Passing hexa decimal values to timestamp.
+--FILE--
+<?php
+/* Prototype : array localtime([int timestamp [, bool associative_array]])
+ * Description: Returns the results of the C system call localtime as an associative array
+ * if the associative_array argument is set to 1 other wise it is a regular array
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing localtime() : usage variation ***\n";
+
+date_default_timezone_set("UTC");
+// Initialise function arguments not being substituted (if any)
+$is_associative = true;
+
+//array of values to iterate over
+$inputs = array(
+
+ 'Hexa-decimal 0' => 0x0,
+ 'Hexa-decimal 10' => 0xA,
+ 'Hexa-decimal -10' => -0XA
+);
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( localtime($value) );
+ var_dump( localtime($value, $is_associative) );
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing localtime() : usage variation ***
+
+--Hexa-decimal 0--
+array(9) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ [4]=>
+ int(0)
+ [5]=>
+ int(70)
+ [6]=>
+ int(4)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+}
+array(9) {
+ ["tm_sec"]=>
+ int(0)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--Hexa-decimal 10--
+array(9) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ [4]=>
+ int(0)
+ [5]=>
+ int(70)
+ [6]=>
+ int(4)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+}
+array(9) {
+ ["tm_sec"]=>
+ int(10)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--Hexa-decimal -10--
+array(9) {
+ [0]=>
+ int(50)
+ [1]=>
+ int(59)
+ [2]=>
+ int(23)
+ [3]=>
+ int(31)
+ [4]=>
+ int(11)
+ [5]=>
+ int(69)
+ [6]=>
+ int(3)
+ [7]=>
+ int(364)
+ [8]=>
+ int(0)
+}
+array(9) {
+ ["tm_sec"]=>
+ int(50)
+ ["tm_min"]=>
+ int(59)
+ ["tm_hour"]=>
+ int(23)
+ ["tm_mday"]=>
+ int(31)
+ ["tm_mon"]=>
+ int(11)
+ ["tm_year"]=>
+ int(69)
+ ["tm_wday"]=>
+ int(3)
+ ["tm_yday"]=>
+ int(364)
+ ["tm_isdst"]=>
+ int(0)
+}
+===DONE===
diff --git a/ext/date/tests/microtime_basic.phpt b/ext/date/tests/microtime_basic.phpt
new file mode 100644
index 000000000..88c495229
--- /dev/null
+++ b/ext/date/tests/microtime_basic.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Test return type and value for expected input microtime()
+--FILE--
+<?php
+/*
+ * proto mixed microtime([bool get_as_float])
+ * Function is implemented in ext/standard/microtime.c
+*/
+
+var_dump(microtime());
+var_dump(microtime(true));
+var_dump(microtime(false));
+
+?>
+===DONE===
+--EXPECTF--
+string(%d) "%s %s"
+float(%s)
+string(%d) "%s %s"
+===DONE===
diff --git a/ext/date/tests/microtime_error.phpt b/ext/date/tests/microtime_error.phpt
new file mode 100644
index 000000000..400df6177
--- /dev/null
+++ b/ext/date/tests/microtime_error.phpt
@@ -0,0 +1,72 @@
+--TEST--
+Test wrong number of arguments for microtime()
+--FILE--
+<?php
+/*
+ * proto mixed microtime([bool get_as_float])
+ * Function is implemented in ext/standard/microtime.c
+*/
+
+$opt_arg_0 = true;
+$extra_arg = 1;
+
+echo "\n-- Too many arguments --\n";
+var_dump(microtime($opt_arg_0, $extra_arg));
+
+
+echo "\n-- Bad Arg types --\n";
+
+$bad_args = array(null,
+ 1.5,
+ "hello",
+ array('k'=>'v', array(0)),
+ new stdClass,
+ 1);
+foreach ($bad_args as $bad_arg) {
+ echo "\n--> bad arg: ";
+ var_dump($bad_arg);
+ var_dump(microtime($bad_arg));
+}
+
+?>
+===DONE===
+--EXPECTF--
+
+-- Too many arguments --
+
+Warning: microtime() expects at most 1 parameter, 2 given in %s on line 11
+NULL
+
+-- Bad Arg types --
+
+--> bad arg: NULL
+string(%d) "%s %s"
+
+--> bad arg: float(1.5)
+float(%s)
+
+--> bad arg: string(5) "hello"
+float(%s)
+
+--> bad arg: array(2) {
+ ["k"]=>
+ string(1) "v"
+ [0]=>
+ array(1) {
+ [0]=>
+ int(0)
+ }
+}
+
+Warning: microtime() expects parameter 1 to be boolean, array given in %s on line 25
+NULL
+
+--> bad arg: object(stdClass)#%d (0) {
+}
+
+Warning: microtime() expects parameter 1 to be boolean, object given in %s on line 25
+NULL
+
+--> bad arg: int(1)
+float(%s)
+===DONE===
diff --git a/ext/date/tests/mktime-3-64bit.phpt b/ext/date/tests/mktime-3-64bit.phpt
index bb3fb2df7..a3649cd14 100644
--- a/ext/date/tests/mktime-3-64bit.phpt
+++ b/ext/date/tests/mktime-3-64bit.phpt
@@ -7,7 +7,7 @@ error_reporting=2047
--FILE--
<?php
$tzs = array("America/Toronto", "Europe/Oslo");
-$years = array(0, 69, 70, 71, 99, 100, 105, 1900, 1901, 1902, 1999, 2000, 2001);
+$years = array(0, 69, 70, 71, 99, 100, 101, 105, 110, 1900, 1901, 1902, 1999, 2000, 2001);
foreach ($tzs as $tz) {
echo $tz, "\n";
@@ -32,7 +32,9 @@ Y: 70 - January 1970-01-01T01:01:01-0500
Y: 71 - January 1971-01-01T01:01:01-0500
Y: 99 - January 1999-01-01T01:01:01-0500
Y: 100 - January 2000-01-01T01:01:01-0500
-Y: 105 - January 2005-01-01T01:01:01-0500
+Y: 101 - January 0101-01-01T01:01:01-0500
+Y: 105 - January 0105-01-01T01:01:01-0500
+Y: 110 - January 0110-01-01T01:01:01-0500
Y: 1900 - January 1900-01-01T01:01:01-0500
Y: 1901 - January 1901-01-01T01:01:01-0500
Y: 1902 - January 1902-01-01T01:01:01-0500
@@ -47,7 +49,9 @@ Y: 70 - January 1970-01-01T01:01:01+0100
Y: 71 - January 1971-01-01T01:01:01+0100
Y: 99 - January 1999-01-01T01:01:01+0100
Y: 100 - January 2000-01-01T01:01:01+0100
-Y: 105 - January 2005-01-01T01:01:01+0100
+Y: 101 - January 0101-01-01T01:01:01+0100
+Y: 105 - January 0105-01-01T01:01:01+0100
+Y: 110 - January 0110-01-01T01:01:01+0100
Y: 1900 - January 1900-01-01T01:01:01+0100
Y: 1901 - January 1901-01-01T01:01:01+0100
Y: 1902 - January 1902-01-01T01:01:01+0100
diff --git a/ext/date/tests/mktime-3.phpt b/ext/date/tests/mktime-3.phpt
index 3201def6c..4347826aa 100644
--- a/ext/date/tests/mktime-3.phpt
+++ b/ext/date/tests/mktime-3.phpt
@@ -24,6 +24,7 @@ foreach ($tzs as $tz) {
echo "\n";
}
?>
+===Done===
--EXPECT--
America/Toronto
Y: 0 - January 2000-01-01T01:01:01-0500
@@ -32,7 +33,7 @@ Y: 70 - January 1970-01-01T01:01:01-0500
Y: 71 - January 1971-01-01T01:01:01-0500
Y: 99 - January 1999-01-01T01:01:01-0500
Y: 100 - January 2000-01-01T01:01:01-0500
-Y: 105 - January 2005-01-01T01:01:01-0500
+Y: 105 - out of range
Y: 1900 - out of range
Y: 1901 - out of range
Y: 1902 - January 1902-01-01T01:01:01-0500
@@ -47,10 +48,12 @@ Y: 70 - January 1970-01-01T01:01:01+0100
Y: 71 - January 1971-01-01T01:01:01+0100
Y: 99 - January 1999-01-01T01:01:01+0100
Y: 100 - January 2000-01-01T01:01:01+0100
-Y: 105 - January 2005-01-01T01:01:01+0100
+Y: 105 - out of range
Y: 1900 - out of range
Y: 1901 - out of range
Y: 1902 - January 1902-01-01T01:01:01+0100
Y: 1999 - January 1999-01-01T01:01:01+0100
Y: 2000 - January 2000-01-01T01:01:01+0100
Y: 2001 - January 2001-01-01T01:01:01+0100
+
+===Done=== \ No newline at end of file
diff --git a/ext/date/tests/strftime_basic.phpt b/ext/date/tests/strftime_basic.phpt
new file mode 100644
index 000000000..07f22af82
--- /dev/null
+++ b/ext/date/tests/strftime_basic.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Test strftime() function : basic functionality
+--FILE--
+<?php
+/* Prototype : string strftime(string format [, int timestamp])
+ * Description: Format a local time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strftime() : basic functionality ***\n";
+
+date_default_timezone_set("Asia/Calcutta");
+// Initialise all required variables
+$format = '%b %d %Y %H:%M:%S';
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+// Calling strftime() with all possible arguments
+var_dump( strftime($format, $timestamp) );
+
+// Calling strftime() with mandatory arguments
+var_dump( strftime($format) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing strftime() : basic functionality ***
+string(20) "Aug 08 2008 08:08:08"
+string(%d) "%s %d %d %d:%d:%d"
+===DONE===
diff --git a/ext/date/tests/strftime_error.phpt b/ext/date/tests/strftime_error.phpt
new file mode 100644
index 000000000..19663798e
--- /dev/null
+++ b/ext/date/tests/strftime_error.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Test strftime() function : error conditions
+--FILE--
+<?php
+/* Prototype : string strftime(string format [, int timestamp])
+ * Description: Format a local time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strftime() : error conditions ***\n";
+
+date_default_timezone_set("Asia/Calcutta");
+//Test strftime with one more than the expected number of arguments
+echo "\n-- Testing strftime() function with more than expected no. of arguments --\n";
+$format = '%b %d %Y %H:%M:%S';
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+$extra_arg = 10;
+var_dump( strftime($format, $timestamp, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing strftime() : error conditions ***
+
+-- Testing strftime() function with more than expected no. of arguments --
+
+Warning: strftime() expects at most 2 parameters, 3 given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/strftime_variation1.phpt b/ext/date/tests/strftime_variation1.phpt
new file mode 100644
index 000000000..4e2b21730
--- /dev/null
+++ b/ext/date/tests/strftime_variation1.phpt
@@ -0,0 +1,222 @@
+--TEST--
+Test strftime() function : usage variation - Passing unexpected values to first argument 'format'.
+--FILE--
+<?php
+/* Prototype : string strftime(string format [, int timestamp])
+ * Description: Format a local time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strftime() : usage variation ***\n";
+
+date_default_timezone_set("Asia/Calcutta");
+
+// Initialise function arguments not being substituted (if any)
+$timestamp = 10;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for format
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( strftime($value) );
+ var_dump( strftime($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing strftime() : usage variation ***
+
+--int 0--
+string(1) "0"
+string(1) "0"
+
+--int 1--
+string(1) "1"
+string(1) "1"
+
+--int 12345--
+string(5) "12345"
+string(5) "12345"
+
+--int -12345--
+string(6) "-12345"
+string(6) "-12345"
+
+--float 10.5--
+string(4) "10.5"
+string(4) "10.5"
+
+--float -10.5--
+string(5) "-10.5"
+string(5) "-10.5"
+
+--float 12.3456789000e10--
+string(12) "123456789000"
+string(12) "123456789000"
+
+--float -12.3456789000e10--
+string(13) "-123456789000"
+string(13) "-123456789000"
+
+--float .5--
+string(3) "0.5"
+string(3) "0.5"
+
+--empty array--
+
+Warning: strftime() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+Warning: strftime() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: strftime() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+Warning: strftime() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: strftime() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+Warning: strftime() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: strftime() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+Warning: strftime() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+bool(false)
+bool(false)
+
+--lowercase null--
+bool(false)
+bool(false)
+
+--lowercase true--
+string(1) "1"
+string(1) "1"
+
+--lowercase false--
+bool(false)
+bool(false)
+
+--uppercase TRUE--
+string(1) "1"
+string(1) "1"
+
+--uppercase FALSE--
+bool(false)
+bool(false)
+
+--empty string DQ--
+bool(false)
+bool(false)
+
+--empty string SQ--
+bool(false)
+bool(false)
+
+--instance of classWithToString--
+string(14) "Class A object"
+string(14) "Class A object"
+
+--instance of classWithoutToString--
+
+Warning: strftime() expects parameter 1 to be string, object given in %s on line %d
+bool(false)
+
+Warning: strftime() expects parameter 1 to be string, object given in %s on line %d
+bool(false)
+
+--undefined var--
+bool(false)
+bool(false)
+
+--unset var--
+bool(false)
+bool(false)
+===DONE===
diff --git a/ext/date/tests/strftime_variation10.phpt b/ext/date/tests/strftime_variation10.phpt
new file mode 100644
index 000000000..7d2a1b8fc
--- /dev/null
+++ b/ext/date/tests/strftime_variation10.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Test strftime() function : usage variation - Checking week related formats which are supported other than on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
+ die("skip Test is not valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string strftime(string format [, int timestamp])
+ * Description: Format a local time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+//array of values to iterate over
+$inputs = array(
+ 'The ISO 8601:1988 week number' => "%V",
+ 'Weekday as decimal' => "%u",
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( strftime($value) );
+ var_dump( strftime($value, $timestamp) );
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing strftime() : usage variation ***
+
+--The ISO 8601:1988 week number--
+string(%d) "%d"
+string(2) "32"
+
+--Weekday as decimal--
+string(%d) "%d"
+string(1) "5"
+===DONE===
diff --git a/ext/date/tests/strftime_variation11.phpt b/ext/date/tests/strftime_variation11.phpt
new file mode 100644
index 000000000..a063f0ad2
--- /dev/null
+++ b/ext/date/tests/strftime_variation11.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test strftime() function : usage variation - Checking month related formats which are not supported on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
+ die("skip Test is valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string strftime(string format [, int timestamp])
+ * Description: Format a local time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+echo "\n-- Testing strftime() function with Abbreviated month name format %h --\n";
+$format = "%h";
+var_dump( strftime($format) );
+var_dump( strftime($format, $timestamp) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing strftime() : usage variation ***
+
+-- Testing strftime() function with Abbreviated month name format %h --
+bool(false)
+bool(false)
+===DONE===
diff --git a/ext/date/tests/strftime_variation12.phpt b/ext/date/tests/strftime_variation12.phpt
new file mode 100644
index 000000000..b798f428f
--- /dev/null
+++ b/ext/date/tests/strftime_variation12.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test strftime() function : usage variation - Checking month related formats which are supported other than on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
+ die("skip Test is not valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string strftime(string format [, int timestamp])
+ * Description: Format a local time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+echo "\n-- Testing strftime() function with Abbreviated month name format %h --\n";
+$format = "%h";
+var_dump( strftime($format) );
+var_dump( strftime($format, $timestamp) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing strftime() : usage variation ***
+
+-- Testing strftime() function with Abbreviated month name format %h --
+string(%d) "%s"
+string(3) "Aug"
+===DONE===
diff --git a/ext/date/tests/strftime_variation13.phpt b/ext/date/tests/strftime_variation13.phpt
new file mode 100644
index 000000000..58ad283ff
--- /dev/null
+++ b/ext/date/tests/strftime_variation13.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test strftime() function : usage variation - Checking date related formats which are not supported on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
+ die("skip Test is valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string strftime(string format [, int timestamp])
+ * Description: Format a local time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+//array of values to iterate over
+$inputs = array(
+ 'Century number' => "%C",
+ 'Month Date Year' => "%D",
+ 'Year with century' => "%G",
+ 'Year without century' => "%g",
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( strftime($value) );
+ var_dump( strftime($value, $timestamp) );
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing strftime() : usage variation ***
+
+--Century number--
+bool(false)
+bool(false)
+
+--Month Date Year--
+bool(false)
+bool(false)
+
+--Year with century--
+bool(false)
+bool(false)
+
+--Year without century--
+bool(false)
+bool(false)
+===DONE===
diff --git a/ext/date/tests/strftime_variation14.phpt b/ext/date/tests/strftime_variation14.phpt
new file mode 100644
index 000000000..7ccb7d283
--- /dev/null
+++ b/ext/date/tests/strftime_variation14.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test strftime() function : usage variation - Checking date related formats which are supported other than on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
+ die("skip Test is not valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string strftime(string format [, int timestamp])
+ * Description: Format a local time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+//array of values to iterate over
+$inputs = array(
+ 'Century number' => "%C",
+ 'Month Date Year' => "%D",
+ 'Year with century' => "%G",
+ 'Year without century' => "%g",
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( strftime($value) );
+ var_dump( strftime($value, $timestamp) );
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing strftime() : usage variation ***
+
+--Century number--
+string(%d) "%d"
+string(2) "20"
+
+--Month Date Year--
+string(%d) "%d/%d/%d"
+string(8) "08/08/08"
+
+--Year with century--
+string(%d) "%d"
+string(4) "2008"
+
+--Year without century--
+string(%d) "%d"
+string(2) "08"
+===DONE===
diff --git a/ext/date/tests/strftime_variation15.phpt b/ext/date/tests/strftime_variation15.phpt
new file mode 100644
index 000000000..5b2946bf5
--- /dev/null
+++ b/ext/date/tests/strftime_variation15.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test strftime() function : usage variation - Checking time related formats which are not supported on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
+ die("skip Test is valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string strftime(string format [, int timestamp])
+ * Description: Format a local time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+//array of values to iterate over
+$inputs = array(
+ 'Time in a.m/p.m notation' => "%r",
+ 'Time in 24 hour notation' => "%R",
+ 'Current time %H:%M:%S format' => "%T",
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( strftime($value) );
+ var_dump( strftime($value, $timestamp) );
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing strftime() : usage variation ***
+
+--Time in a.m/p.m notation--
+bool(false)
+bool(false)
+
+--Time in 24 hour notation--
+bool(false)
+bool(false)
+
+--Current time %H:%M:%S format--
+bool(false)
+bool(false)
+===DONE===
diff --git a/ext/date/tests/strftime_variation16.phpt b/ext/date/tests/strftime_variation16.phpt
new file mode 100644
index 000000000..5103b3add
--- /dev/null
+++ b/ext/date/tests/strftime_variation16.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test strftime() function : usage variation - Checking time related formats which are supported other than on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
+ die("skip Test is not valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string strftime(string format [, int timestamp])
+ * Description: Format a local time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+//array of values to iterate over
+$inputs = array(
+ 'Time in a.m/p.m notation' => "%r",
+ 'Time in 24 hour notation' => "%R",
+ 'Current time %H:%M:%S format' => "%T",
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( strftime($value) );
+ var_dump( strftime($value, $timestamp) );
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing strftime() : usage variation ***
+
+--Time in a.m/p.m notation--
+string(%d) "%d:%d:%d %s"
+string(11) "08:08:08 AM"
+
+--Time in 24 hour notation--
+string(%d) "%d:%d"
+string(5) "08:08"
+
+--Current time %H:%M:%S format--
+string(%d) "%d:%d:%d"
+string(8) "08:08:08"
+===DONE===
diff --git a/ext/date/tests/strftime_variation17.phpt b/ext/date/tests/strftime_variation17.phpt
new file mode 100644
index 000000000..90b3269e8
--- /dev/null
+++ b/ext/date/tests/strftime_variation17.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Test strftime() function : usage variation - Checking day related formats which are not supported on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
+ die("skip Test is valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string strftime(string format [, int timestamp])
+ * Description: Format a local time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+echo "\n-- Testing strftime() function with Day of the month as decimal single digit format --\n";
+$format = "%e";
+var_dump( strftime($format) );
+var_dump( strftime($format, $timestamp) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing strftime() : usage variation ***
+
+-- Testing strftime() function with Day of the month as decimal single digit format --
+bool(false)
+bool(false)
+===DONE===
diff --git a/ext/date/tests/strftime_variation18.phpt b/ext/date/tests/strftime_variation18.phpt
new file mode 100644
index 000000000..4340325df
--- /dev/null
+++ b/ext/date/tests/strftime_variation18.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Test strftime() function : usage variation - Checking day related formats which are supported other than on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
+ die("skip Test is not valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string strftime(string format [, int timestamp])
+ * Description: Format a local time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+echo "\n-- Testing strftime() function with Day of the month as decimal single digit format --\n";
+$format = "%e";
+var_dump( strftime($format) );
+var_dump( strftime($format, $timestamp) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing strftime() : usage variation ***
+
+-- Testing strftime() function with Day of the month as decimal single digit format --
+string(%d) "%s"
+string(2) " 8"
+===DONE===
diff --git a/ext/date/tests/strftime_variation19.phpt b/ext/date/tests/strftime_variation19.phpt
new file mode 100644
index 000000000..b41607719
--- /dev/null
+++ b/ext/date/tests/strftime_variation19.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Test strftime() function : usage variation - Checking newline and tab formats which are not supported on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
+ die("skip Test is valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string strftime(string format [, int timestamp])
+ * Description: Format a local time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+//array of values to iterate over
+$inputs = array(
+ 'Newline character' => "%n",
+ 'Tab character' => "%t"
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( strftime($value) );
+ var_dump( strftime($value, $timestamp) );
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing strftime() : usage variation ***
+
+--Newline character--
+bool(false)
+bool(false)
+
+--Tab character--
+bool(false)
+bool(false)
+===DONE===
diff --git a/ext/date/tests/strftime_variation2.phpt b/ext/date/tests/strftime_variation2.phpt
new file mode 100644
index 000000000..b02423495
--- /dev/null
+++ b/ext/date/tests/strftime_variation2.phpt
@@ -0,0 +1,191 @@
+--TEST--
+Test strftime() function : usage variation - Passing unexpected values to second argument 'timestamp'.
+--FILE--
+<?php
+/* Prototype : string strftime(string format [, int timestamp])
+ * Description: Format a local time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strftime() : usage variation ***\n";
+
+date_default_timezone_set("Asia/Calcutta");
+// Initialise all required variables
+$format = '%b %d %Y %H:%M:%S';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( strftime($format, $value) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing strftime() : usage variation ***
+
+--float 10.5--
+string(20) "Jan 01 1970 05:30:10"
+
+--float -10.5--
+string(20) "Jan 01 1970 05:29:50"
+
+--float .5--
+string(20) "Jan 01 1970 05:30:00"
+
+--empty array--
+
+Warning: strftime() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: strftime() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: strftime() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: strftime() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+string(20) "Jan 01 1970 05:30:00"
+
+--lowercase null--
+string(20) "Jan 01 1970 05:30:00"
+
+--lowercase true--
+string(20) "Jan 01 1970 05:30:01"
+
+--lowercase false--
+string(20) "Jan 01 1970 05:30:00"
+
+--uppercase TRUE--
+string(20) "Jan 01 1970 05:30:01"
+
+--uppercase FALSE--
+string(20) "Jan 01 1970 05:30:00"
+
+--empty string DQ--
+
+Warning: strftime() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: strftime() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--string DQ--
+
+Warning: strftime() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--string SQ--
+
+Warning: strftime() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--mixed case string--
+
+Warning: strftime() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--heredoc--
+
+Warning: strftime() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: strftime() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: strftime() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+
+--undefined var--
+string(20) "Jan 01 1970 05:30:00"
+
+--unset var--
+string(20) "Jan 01 1970 05:30:00"
+===DONE===
diff --git a/ext/date/tests/strftime_variation20.phpt b/ext/date/tests/strftime_variation20.phpt
new file mode 100644
index 000000000..336c6d2af
--- /dev/null
+++ b/ext/date/tests/strftime_variation20.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Test strftime() function : usage variation - Checking newline and tab formats which are supported other than on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
+ die("skip Test is not valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string strftime(string format [, int timestamp])
+ * Description: Format a local time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+//array of values to iterate over
+$inputs = array(
+ 'Newline character' => "%n",
+ 'Tab character' => "%t"
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( strftime($value) );
+ var_dump( strftime($value, $timestamp) );
+}
+
+?>
+===DONE===
+--EXPECTREGEX--
+\*\*\* Testing strftime\(\) : usage variation \*\*\*
+
+--Newline character--
+string\(1\) "
+"
+string\(1\) "
+"
+
+--Tab character--
+string\(1\) "\s"
+string\(1\) "\s"
+===DONE===
diff --git a/ext/date/tests/strftime_variation21.phpt b/ext/date/tests/strftime_variation21.phpt
new file mode 100644
index 000000000..f6aed15ef
--- /dev/null
+++ b/ext/date/tests/strftime_variation21.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test strftime() function : usage variation - Checking Preferred date and time representation on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
+ die("skip Test is valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string strftime(string format [, int timestamp])
+ * Description: Format a local time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+//array of values to iterate over
+$inputs = array(
+ 'Preferred date and time representation' => "%c",
+ 'Preferred date representation' => "%x",
+ 'Preferred time representation' => "%X",
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( strftime($value) );
+ var_dump( strftime($value, $timestamp) );
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing strftime() : usage variation ***
+
+--Preferred date and time representation--
+string(%d) "%d/%d/%d %d:%d:%d"
+string(17) "08/08/08 08:08:08"
+
+--Preferred date representation--
+string(%d) "%d/%d/%d"
+string(8) "08/08/08"
+
+--Preferred time representation--
+string(%d) "%d:%d:%d"
+string(8) "08:08:08"
+===DONE===
diff --git a/ext/date/tests/strftime_variation22.phpt b/ext/date/tests/strftime_variation22.phpt
new file mode 100644
index 000000000..8ea259caf
--- /dev/null
+++ b/ext/date/tests/strftime_variation22.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test strftime() function : usage variation - Checking Preferred date and time representation other than on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
+ die("skip Test is not valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string strftime(string format [, int timestamp])
+ * Description: Format a local time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+//array of values to iterate over
+$inputs = array(
+ 'Preferred date and time representation' => "%c",
+ 'Preferred date representation' => "%x",
+ 'Preferred time representation' => "%X",
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( strftime($value) );
+ var_dump( strftime($value, $timestamp) );
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing strftime() : usage variation ***
+
+--Preferred date and time representation--
+string(%d) "%s %d %s %d %d:%d:%d %s %s"
+string(31) "Fri 08 Aug 2008 08:08:08 AM IST"
+
+--Preferred date representation--
+string(%d) "%d/%d/%d"
+string(10) "08/08/2008"
+
+--Preferred time representation--
+string(%d) "%d:%d:%d %s"
+string(11) "08:08:08 AM"
+===DONE===
diff --git a/ext/date/tests/strftime_variation23.phpt b/ext/date/tests/strftime_variation23.phpt
new file mode 100644
index 000000000..b7cf8d788
--- /dev/null
+++ b/ext/date/tests/strftime_variation23.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Test strftime() function : usage variation - Checking large positive and negative float values to timestamp.
+--FILE--
+<?php
+/* Prototype : string strftime(string format [, int timestamp])
+ * Description: Format a local time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("UTC");
+$format = '%b %d %Y %H:%M:%S';
+
+echo "\n-- Testing strftime() function with float 12.3456789000e10 to timestamp --\n";
+$timestamp = 12.3456789000e10;
+var_dump( strftime($format, $timestamp) );
+
+echo "\n-- Testing strftime() function with float -12.3456789000e10 to timestamp --\n";
+$timestamp = -12.3456789000e10;
+var_dump( strftime($format, $timestamp) );
+
+?>
+===DONE===
+--EXPECTREGEX--
+\*\*\* Testing strftime\(\) : usage variation \*\*\*
+
+-- Testing strftime\(\) function with float 12.3456789000e10 to timestamp --
+string\(\d*\)\s"Mar\s(26|11)\s(1935|5882)\s(04|00):(50|30):(16|00)"
+
+-- Testing strftime\(\) function with float -12.3456789000e10 to timestamp --
+string\(\d*\)\s"(Oct|Dec)\s(08|13|22)\s(2004|1901|-1943)\s(19|20|23):(09|45|30):(44|52|00)"
+===DONE===
diff --git a/ext/date/tests/strftime_variation3.phpt b/ext/date/tests/strftime_variation3.phpt
new file mode 100644
index 000000000..342cb7692
--- /dev/null
+++ b/ext/date/tests/strftime_variation3.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Test strftime() function : usage variation - Passing week related format strings to format argument.
+--FILE--
+<?php
+/* Prototype : string strftime(string format [, int timestamp])
+ * Description: Format a local time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strftime() : usage variation ***\n";
+
+date_default_timezone_set("Asia/Calcutta");
+// Initialise function arguments not being substituted (if any)
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+//array of values to iterate over
+$inputs = array(
+ 'Abbreviated weekday name' => "%a",
+ 'Full weekday name' => "%A",
+ 'Week number of the year' => "%U",
+ 'Week number of the year in decimal number' => "%W",
+);
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( strftime($value) );
+ var_dump( strftime($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing strftime() : usage variation ***
+
+--Abbreviated weekday name--
+string(%d) "%s"
+string(3) "Fri"
+
+--Full weekday name--
+string(%d) "%s"
+string(6) "Friday"
+
+--Week number of the year--
+string(%d) "%d"
+string(2) "31"
+
+--Week number of the year in decimal number--
+string(%d) "%d"
+string(2) "31"
+===DONE===
diff --git a/ext/date/tests/strftime_variation4.phpt b/ext/date/tests/strftime_variation4.phpt
new file mode 100644
index 000000000..6236dd9e7
--- /dev/null
+++ b/ext/date/tests/strftime_variation4.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Test strftime() function : usage variation - Passing month related format strings to format argument.
+--FILE--
+<?php
+/* Prototype : string strftime(string format [, int timestamp])
+ * Description: Format a local time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strftime() : usage variation ***\n";
+
+date_default_timezone_set("Asia/Calcutta");
+// Initialise function arguments not being substituted (if any)
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+//array of values to iterate over
+$inputs = array(
+ 'Abbreviated month name' => "%b",
+ 'Full month name' => "%B",
+ 'Month as decimal' => "%m",
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( strftime($value) );
+ var_dump( strftime($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing strftime() : usage variation ***
+
+--Abbreviated month name--
+string(%d) "%s"
+string(3) "Aug"
+
+--Full month name--
+string(%d) "%s"
+string(6) "August"
+
+--Month as decimal--
+string(%d) "%d"
+string(2) "08"
+===DONE===
diff --git a/ext/date/tests/strftime_variation5.phpt b/ext/date/tests/strftime_variation5.phpt
new file mode 100644
index 000000000..90f4e37ba
--- /dev/null
+++ b/ext/date/tests/strftime_variation5.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Test strftime() function : usage variation - Passing date related format strings to format argument.
+--FILE--
+<?php
+/* Prototype : string strftime(string format [, int timestamp])
+ * Description: Format a local time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+//array of values to iterate over
+$inputs = array(
+ 'Year as decimal number without a century' => "%y",
+ 'Year as decimal number including the century' => "%Y",
+ 'Time zone offset' => "%Z",
+ 'Time zone offset' => "%z",
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( strftime($value) );
+ var_dump( strftime($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing strftime() : usage variation ***
+
+--Year as decimal number without a century--
+string(%d) "%d"
+string(2) "08"
+
+--Year as decimal number including the century--
+string(%d) "%d"
+string(4) "2008"
+
+--Time zone offset--
+string(%d) "%s"
+string(%d) "%s"
+===DONE===
diff --git a/ext/date/tests/strftime_variation6.phpt b/ext/date/tests/strftime_variation6.phpt
new file mode 100644
index 000000000..6713a198e
--- /dev/null
+++ b/ext/date/tests/strftime_variation6.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test strftime() function : usage variation - Passing time related format strings to format argument.
+--FILE--
+<?php
+/* Prototype : string strftime(string format [, int timestamp])
+ * Description: Format a local time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+$timestamp = mktime(18, 8, 8, 8, 8, 2008);
+
+
+//array of values to iterate over
+$inputs = array(
+ 'Hour as decimal by 24-hour format' => "%H",
+ 'Hour as decimal by 12-hour format' => "%I",
+ 'Minute as decimal number' => "%M",
+ 'AM/PM format for a time' => "%p",
+ 'Second as decimal number' => "%S",
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( strftime($value) );
+ var_dump( strftime($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing strftime() : usage variation ***
+
+--Hour as decimal by 24-hour format--
+string(%d) "%d"
+string(2) "18"
+
+--Hour as decimal by 12-hour format--
+string(%d) "%d"
+string(2) "06"
+
+--Minute as decimal number--
+string(%d) "%d"
+string(2) "08"
+
+--AM/PM format for a time--
+string(%d) "%s"
+string(2) "PM"
+
+--Second as decimal number--
+string(%d) "%d"
+string(2) "08"
+===DONE===
diff --git a/ext/date/tests/strftime_variation7.phpt b/ext/date/tests/strftime_variation7.phpt
new file mode 100644
index 000000000..67fd416ac
--- /dev/null
+++ b/ext/date/tests/strftime_variation7.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Test strftime() function : usage variation - Passing day related format strings to format argument.
+--FILE--
+<?php
+/* Prototype : string strftime(string format [, int timestamp])
+ * Description: Format a local time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+$timestamp = mktime(18, 8, 8, 8, 8, 2008);
+
+
+//array of values to iterate over
+$inputs = array(
+ 'Day of the month as a decimal number' => "%d",
+ 'Day of the year as a decimal number' => "%j",
+ 'Day of the week as a decimal number' => "%w"
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( strftime($value) );
+ var_dump( strftime($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing strftime() : usage variation ***
+
+--Day of the month as a decimal number--
+string(%d) "%d"
+string(2) "08"
+
+--Day of the year as a decimal number--
+string(%d) "%d"
+string(3) "221"
+
+--Day of the week as a decimal number--
+string(%d) "%d"
+string(1) "5"
+===DONE===
diff --git a/ext/date/tests/strftime_variation8.phpt b/ext/date/tests/strftime_variation8.phpt
new file mode 100644
index 000000000..af8089f98
--- /dev/null
+++ b/ext/date/tests/strftime_variation8.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test strftime() function : usage variation - Passing literal related strings to format argument.
+--FILE--
+<?php
+/* Prototype : string strftime(string format [, int timestamp])
+ * Description: Format a local time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+$format = "%%";
+
+echo "\n-- Testing strftime() function with a literal % character to format --\n";
+var_dump( strftime($format) );
+var_dump( strftime($format, $timestamp) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing strftime() : usage variation ***
+
+-- Testing strftime() function with a literal % character to format --
+string(1) "%"
+string(1) "%"
+===DONE===
diff --git a/ext/date/tests/strftime_variation9.phpt b/ext/date/tests/strftime_variation9.phpt
new file mode 100644
index 000000000..23aa92d98
--- /dev/null
+++ b/ext/date/tests/strftime_variation9.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Test strftime() function : usage variation - Checking week related formats which are not supported on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
+ die("skip Test is valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string strftime(string format [, int timestamp])
+ * Description: Format a local time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+//array of values to iterate over
+$inputs = array(
+ 'The ISO 8601:1988 week number' => "%V",
+ 'Weekday as decimal' => "%u",
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( strftime($value) );
+ var_dump( strftime($value, $timestamp) );
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing strftime() : usage variation ***
+
+--The ISO 8601:1988 week number--
+bool(false)
+bool(false)
+
+--Weekday as decimal--
+bool(false)
+bool(false)
+===DONE===
diff --git a/ext/date/tests/strtotime_basic.phpt b/ext/date/tests/strtotime_basic.phpt
new file mode 100644
index 000000000..15caa2f53
--- /dev/null
+++ b/ext/date/tests/strtotime_basic.phpt
@@ -0,0 +1,47 @@
+--TEST--
+strtotime() function - a test to show the difference in behaviour between 'first' and '1', "second" and "2"...
+--INI--
+date.timezone="UTC"
+--SKIPIF--
+<?php if (!function_exists('strtotime')) echo "SKIP"; ?>
+--FILE--
+<?php
+/*
+ * The first of December 2008 is a Monday.
+ * The term "Monday December 2008" will be parsed as the first Monday in December 2008.
+ */
+
+/*
+ * This is parsed as the "first following Monday OR the current day if it is a Monday"
+ */
+var_dump(date('Y-m-d', strtotime('1 Monday December 2008')));
+/*
+ * This is parsed as the "second following Monday OR the first following
+ * Monday if the current day is a Monday"
+ */
+var_dump(date('Y-m-d', strtotime('2 Monday December 2008')));
+/*
+ * This is parsed as the "third following Monday OR the second following
+ * Monday if the current day is a Monday"
+ */
+var_dump(date('Y-m-d', strtotime('3 Monday December 2008')));
+/*
+ * This is parsed as the "first following Monday after the first Monday in December"
+ */
+var_dump(date('Y-m-d', strtotime('first Monday December 2008')));
+/*
+ * This is parsed as the "second following Monday after the first Monday in December"
+ */
+var_dump(date('Y-m-d', strtotime('second Monday December 2008')));
+/*
+ * This is parsed as the "third following Monday after the first Monday in December"
+ */
+var_dump(date('Y-m-d', strtotime('third Monday December 2008')));
+?>
+--EXPECTF--
+string(10) "2008-12-01"
+string(10) "2008-12-08"
+string(10) "2008-12-15"
+string(10) "2008-12-08"
+string(10) "2008-12-15"
+string(10) "2008-12-22"
diff --git a/ext/date/tests/time_basic.phpt b/ext/date/tests/time_basic.phpt
new file mode 100644
index 000000000..ad788f907
--- /dev/null
+++ b/ext/date/tests/time_basic.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Test return type and value for expected input time()
+--FILE--
+<?php
+/*
+ * proto int time(void)
+ * Function is implemented in ext/date/php_date.c
+*/
+
+var_dump(time());
+
+?>
+===DONE===
+--EXPECTF--
+int(%d)
+===DONE===
diff --git a/ext/date/tests/time_error.phpt b/ext/date/tests/time_error.phpt
new file mode 100644
index 000000000..3792570cf
--- /dev/null
+++ b/ext/date/tests/time_error.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Test wrong number of arguments for time()
+--FILE--
+<?php
+/*
+ * proto int time(void)
+ * Function is implemented in ext/date/php_date.c
+*/
+
+// Extra arguments are ignored
+$extra_arg = 1;
+echo "\n-- Too many arguments --\n";
+var_dump (time($extra_arg));
+?>
+===DONE===
+--EXPECTF--
+
+-- Too many arguments --
+int(%d)
+===DONE===