summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerick Rethans <derick@php.net>2008-02-25 22:34:11 +0000
committerDerick Rethans <derick@php.net>2008-02-25 22:34:11 +0000
commita58f8d2a9bba1ad085b262d81c4dfca026c8d622 (patch)
tree234909c4b933e328f713ddf60ab7246913a9d0d2
parent08e237cc6db931ffd727f3257085d8f54410a458 (diff)
downloadphp-git-a58f8d2a9bba1ad085b262d81c4dfca026c8d622.tar.gz
- MFH: Fixed tests on 64bit platform.
-rw-r--r--ext/date/tests/bug41523-64bit.phpt47
-rw-r--r--ext/date/tests/bug41523.phpt4
-rw-r--r--ext/date/tests/mktime-3-64bit.phpt56
-rw-r--r--ext/date/tests/mktime-3.phpt4
-rw-r--r--ext/date/tests/strtotime-mysql-64bit.phpt28
-rwxr-xr-xext/date/tests/strtotime-mysql.phpt4
-rw-r--r--ext/date/tests/strtotime3-64bit.phpt71
-rw-r--r--ext/date/tests/strtotime3.phpt4
-rw-r--r--ext/wddx/tests/001-64bit.phpt62
-rw-r--r--ext/wddx/tests/001.phpt3
10 files changed, 278 insertions, 5 deletions
diff --git a/ext/date/tests/bug41523-64bit.phpt b/ext/date/tests/bug41523-64bit.phpt
new file mode 100644
index 0000000000..9b4e900619
--- /dev/null
+++ b/ext/date/tests/bug41523-64bit.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Bug #41523 (strtotime('0000-00-00 00:00:00') is parsed as 1999-11-30) (64 bit)
+--SKIPIF--
+<?php echo PHP_INT_SIZE != 8 ? "skip 64-bit only" : "OK"; ?>
+--FILE--
+<?php
+date_default_timezone_set("UTC");
+
+var_dump( date_parse('0000-00-00 00:00:00') );
+var_dump( strtotime('0000-00-00 00:00:00') );
+var_dump( $dt = new DateTime('0000-00-00 00:00:00') );
+echo $dt->format( DateTime::ISO8601 ), "\n";
+
+?>
+--EXPECT--
+array(12) {
+ ["year"]=>
+ int(0)
+ ["month"]=>
+ int(0)
+ ["day"]=>
+ int(0)
+ ["hour"]=>
+ int(0)
+ ["minute"]=>
+ int(0)
+ ["second"]=>
+ int(0)
+ ["fraction"]=>
+ float(0)
+ ["warning_count"]=>
+ int(0)
+ ["warnings"]=>
+ array(0) {
+ }
+ ["error_count"]=>
+ int(0)
+ ["errors"]=>
+ array(0) {
+ }
+ ["is_localtime"]=>
+ bool(false)
+}
+int(-62169984000)
+object(DateTime)#1 (0) {
+}
+-0001-11-30T00:00:00+0000
diff --git a/ext/date/tests/bug41523.phpt b/ext/date/tests/bug41523.phpt
index c8aa00fd76..5b0d5bd196 100644
--- a/ext/date/tests/bug41523.phpt
+++ b/ext/date/tests/bug41523.phpt
@@ -1,5 +1,7 @@
--TEST--
-Bug #41523 (strtotime('0000-00-00 00:00:00') is parsed as 1999-11-30)
+Bug #41523 (strtotime('0000-00-00 00:00:00') is parsed as 1999-11-30) (32 bit)
+--SKIPIF--
+<?php echo PHP_INT_SIZE == 8 ? "skip 32-bit only" : "OK"; ?>
--FILE--
<?php
date_default_timezone_set("UTC");
diff --git a/ext/date/tests/mktime-3-64bit.phpt b/ext/date/tests/mktime-3-64bit.phpt
new file mode 100644
index 0000000000..bb3fb2df74
--- /dev/null
+++ b/ext/date/tests/mktime-3-64bit.phpt
@@ -0,0 +1,56 @@
+--TEST--
+mktime() [3] (64-bit)
+--SKIPIF--
+<?php echo PHP_INT_SIZE != 8 ? "skip 64-bit only" : "OK" ?>
+--INI--
+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);
+
+foreach ($tzs as $tz) {
+ echo $tz, "\n";
+ date_default_timezone_set($tz);
+ foreach ($years as $year) {
+ printf("Y: %4d - ", $year);
+ $ret = mktime(1, 1, 1, 1, 1, $year);
+ if ($ret == FALSE) {
+ echo "out of range\n";
+ } else {
+ echo date("F ".DATE_ISO8601, $ret), "\n";
+ }
+ }
+ echo "\n";
+}
+?>
+--EXPECT--
+America/Toronto
+Y: 0 - January 2000-01-01T01:01:01-0500
+Y: 69 - January 2069-01-01T01:01:01-0500
+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: 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
+Y: 1999 - January 1999-01-01T01:01:01-0500
+Y: 2000 - January 2000-01-01T01:01:01-0500
+Y: 2001 - January 2001-01-01T01:01:01-0500
+
+Europe/Oslo
+Y: 0 - January 2000-01-01T01:01:01+0100
+Y: 69 - January 2069-01-01T01:01:01+0100
+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: 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
+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
diff --git a/ext/date/tests/mktime-3.phpt b/ext/date/tests/mktime-3.phpt
index 0d19074fc3..3201def6ca 100644
--- a/ext/date/tests/mktime-3.phpt
+++ b/ext/date/tests/mktime-3.phpt
@@ -1,5 +1,7 @@
--TEST--
-mktime() [3]
+mktime() [3] (32-bit)
+--SKIPIF--
+<?php echo PHP_INT_SIZE == 8 ? "skip 32-bit only" : "OK" ?>
--INI--
error_reporting=2047
--FILE--
diff --git a/ext/date/tests/strtotime-mysql-64bit.phpt b/ext/date/tests/strtotime-mysql-64bit.phpt
new file mode 100644
index 0000000000..38e7f15dff
--- /dev/null
+++ b/ext/date/tests/strtotime-mysql-64bit.phpt
@@ -0,0 +1,28 @@
+--TEST--
+strtotime() and mysql timestamps (64 bit)
+--SKIPIF--
+<?php echo PHP_INT_SIZE != 8 ? "skip 64-bit only" : "OK"; ?>
+--FILE--
+<?php
+date_default_timezone_set('UTC');
+
+/* Format: YYYYMMDDHHMMSS */
+$d[] = '19970523091528';
+$d[] = '20001231185859';
+$d[] = '20800410101010'; // overflow..
+
+foreach($d as $date) {
+ $time = strtotime($date);
+
+ if (is_integer($time)) {
+ var_dump(date('r', $time));
+ } else {
+ var_dump($time);
+ }
+}
+?>
+--EXPECT--
+string(31) "Fri, 23 May 1997 09:15:28 +0000"
+string(31) "Sun, 31 Dec 2000 18:58:59 +0000"
+string(31) "Wed, 10 Apr 2080 10:10:10 +0000"
+
diff --git a/ext/date/tests/strtotime-mysql.phpt b/ext/date/tests/strtotime-mysql.phpt
index 88a8f10fed..e5935bb165 100755
--- a/ext/date/tests/strtotime-mysql.phpt
+++ b/ext/date/tests/strtotime-mysql.phpt
@@ -1,5 +1,7 @@
--TEST--
-strtotime() and mysql timestamps
+strtotime() and mysql timestamps (32 bit)
+--SKIPIF--
+<?php echo PHP_INT_SIZE == 8 ? "skip 32-bit only" : "OK"; ?>
--FILE--
<?php
date_default_timezone_set('UTC');
diff --git a/ext/date/tests/strtotime3-64bit.phpt b/ext/date/tests/strtotime3-64bit.phpt
new file mode 100644
index 0000000000..7dc0816359
--- /dev/null
+++ b/ext/date/tests/strtotime3-64bit.phpt
@@ -0,0 +1,71 @@
+--TEST--
+strtotime() function (64 bit)
+--SKIPIF--
+<?php echo PHP_INT_SIZE != 8 ? "skip 64-bit only" : "OK"; ?>
+--FILE--
+<?php
+date_default_timezone_set('Europe/Lisbon');
+$time = 1150494719; // 16/June/2006
+
+$strs = array(
+ '',
+ " \t\r\n000",
+ 'yesterday',
+ '22:49:12',
+ '22:49:12 bogusTZ',
+ '22.49.12.42GMT',
+ '22.49.12.42bogusTZ',
+ 't0222',
+ 't0222 t0222',
+ '022233',
+ '022233 bogusTZ',
+ '2-3-2004',
+ '2.3.2004',
+ '20060212T23:12:23UTC',
+ '20060212T23:12:23 bogusTZ',
+ '2006167', //pgydotd
+ 'Jan-15-2006', //pgtextshort
+ '2006-Jan-15', //pgtextreverse
+ '10/Oct/2000:13:55:36 +0100', //clf
+ '10/Oct/2000:13:55:36 +00100', //clf
+ '2006',
+ '1986', // year
+ 'JAN',
+ 'January',
+);
+
+foreach ($strs as $str) {
+ $t = strtotime($str, $time);
+ if (is_integer($t)) {
+ var_dump(date(DATE_RFC2822, $t));
+ } else {
+ var_dump($t);
+ }
+}
+
+?>
+--EXPECT--
+bool(false)
+bool(false)
+string(31) "Thu, 15 Jun 2006 00:00:00 +0100"
+string(31) "Fri, 16 Jun 2006 22:49:12 +0100"
+bool(false)
+string(31) "Fri, 16 Jun 2006 23:49:12 +0100"
+bool(false)
+string(31) "Fri, 16 Jun 2006 02:22:00 +0100"
+string(31) "Mon, 16 Jun 0222 02:22:00 -0036"
+string(31) "Fri, 16 Jun 2006 02:22:33 +0100"
+bool(false)
+string(31) "Tue, 02 Mar 2004 00:00:00 +0000"
+string(31) "Tue, 02 Mar 2004 00:00:00 +0000"
+string(31) "Sun, 12 Feb 2006 23:12:23 +0000"
+bool(false)
+string(31) "Fri, 16 Jun 2006 00:00:00 +0100"
+string(31) "Sun, 15 Jan 2006 00:00:00 +0000"
+string(31) "Sun, 15 Jan 2006 00:00:00 +0000"
+string(31) "Tue, 10 Oct 2000 13:55:36 +0100"
+bool(false)
+string(31) "Fri, 16 Jun 2006 20:06:00 +0100"
+string(31) "Mon, 16 Jun 1986 22:51:59 +0100"
+string(31) "Mon, 16 Jan 2006 00:00:00 +0000"
+string(31) "Mon, 16 Jan 2006 00:00:00 +0000"
diff --git a/ext/date/tests/strtotime3.phpt b/ext/date/tests/strtotime3.phpt
index c5d13d8a6f..6aa5640f64 100644
--- a/ext/date/tests/strtotime3.phpt
+++ b/ext/date/tests/strtotime3.phpt
@@ -1,5 +1,7 @@
--TEST--
-strtotime() function
+strtotime() function (32 bit)
+--SKIPIF--
+<?php echo PHP_INT_SIZE == 8 ? "skip 32-bit only" : "OK"; ?>
--FILE--
<?php
date_default_timezone_set('Europe/Lisbon');
diff --git a/ext/wddx/tests/001-64bit.phpt b/ext/wddx/tests/001-64bit.phpt
new file mode 100644
index 0000000000..78b1dc9994
--- /dev/null
+++ b/ext/wddx/tests/001-64bit.phpt
@@ -0,0 +1,62 @@
+--TEST--
+wddx deserialization test (64-bit)
+--SKIPIF--
+<?php if (!extension_loaded("wddx")) print "skip"; ?>
+<?php echo PHP_INT_SIZE != 8 ? "skip 64-bit only" : "OK" ?>
+--INI--
+precision=14
+--FILE--
+<?php
+ $path = dirname(__FILE__);
+ var_dump(wddx_deserialize(file_get_contents("{$path}/wddx.xml")));
+?>
+--EXPECT--
+array(11) {
+ ["aNull"]=>
+ NULL
+ ["aString"]=>
+ string(8) "a string"
+ ["aNumber"]=>
+ float(-12.456)
+ ["aDateTime"]=>
+ int(897625932)
+ ["aDateTime2"]=>
+ int(329632332)
+ ["aDateTime3"]=>
+ int(2223088332)
+ ["aBoolean"]=>
+ bool(true)
+ ["anArray"]=>
+ array(2) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(14) "second element"
+ }
+ ["aBinary"]=>
+ string(11) "binary data"
+ ["anObject"]=>
+ array(2) {
+ ["s"]=>
+ string(8) "a string"
+ ["n"]=>
+ float(-12.456)
+ }
+ ["aRecordset"]=>
+ array(2) {
+ ["NAME"]=>
+ array(2) {
+ [0]=>
+ string(8) "John Doe"
+ [1]=>
+ string(8) "Jane Doe"
+ }
+ ["AGE"]=>
+ array(2) {
+ [0]=>
+ int(34)
+ [1]=>
+ int(31)
+ }
+ }
+}
diff --git a/ext/wddx/tests/001.phpt b/ext/wddx/tests/001.phpt
index 3efc0f4b07..e1aafd0ab0 100644
--- a/ext/wddx/tests/001.phpt
+++ b/ext/wddx/tests/001.phpt
@@ -1,7 +1,8 @@
--TEST--
-wddx deserialization test
+wddx deserialization test (32-bit)
--SKIPIF--
<?php if (!extension_loaded("wddx")) print "skip"; ?>
+<?php echo PHP_INT_SIZE == 8 ? "skip 32-bit only" : "OK" ?>
--INI--
precision=14
--FILE--