mirror of
https://github.com/php/php-src.git
synced 2025-01-19 02:03:47 +08:00
- MFH: Fixed tests on 64bit platform.
This commit is contained in:
parent
b8883b65b8
commit
f81134a9f2
47
ext/date/tests/bug41523-64bit.phpt
Normal file
47
ext/date/tests/bug41523-64bit.phpt
Normal file
@ -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
|
@ -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");
|
||||
|
56
ext/date/tests/mktime-3-64bit.phpt
Normal file
56
ext/date/tests/mktime-3-64bit.phpt
Normal file
@ -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
|
@ -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--
|
||||
|
28
ext/date/tests/strtotime-mysql-64bit.phpt
Normal file
28
ext/date/tests/strtotime-mysql-64bit.phpt
Normal file
@ -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"
|
||||
|
@ -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');
|
||||
|
71
ext/date/tests/strtotime3-64bit.phpt
Normal file
71
ext/date/tests/strtotime3-64bit.phpt
Normal file
@ -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"
|
@ -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');
|
||||
|
62
ext/wddx/tests/001-64bit.phpt
Normal file
62
ext/wddx/tests/001-64bit.phpt
Normal file
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
@ -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--
|
||||
|
Loading…
Reference in New Issue
Block a user