2006-12-22 13:07:53 +00:00
|
|
|
--TEST--
|
|
|
|
Test basic date_parse()
|
|
|
|
--FILE--
|
|
|
|
<?php
|
2009-01-27 14:16:15 +00:00
|
|
|
date_default_timezone_set('UTC');
|
2006-12-22 13:07:53 +00:00
|
|
|
var_dump(date_parse("2006-12-12 10:00:00.5"));
|
2009-01-27 14:16:15 +00:00
|
|
|
var_dump(date_parse("2006-12-12"));
|
2006-12-22 13:07:53 +00:00
|
|
|
var_dump(date_parse("2006-12--12"));
|
|
|
|
var_dump(date_parse("2006-02-30"));
|
|
|
|
var_dump(date_parse("2006-03-04"));
|
|
|
|
var_dump(date_parse("2006-03"));
|
|
|
|
var_dump(date_parse("03-03"));
|
|
|
|
var_dump(date_parse("0-0"));
|
|
|
|
var_dump(date_parse(""));
|
|
|
|
var_dump(date_parse(array()));
|
|
|
|
echo "Done\n";
|
|
|
|
?>
|
|
|
|
--EXPECTF--
|
|
|
|
array(12) {
|
|
|
|
["year"]=>
|
|
|
|
int(2006)
|
|
|
|
["month"]=>
|
|
|
|
int(12)
|
|
|
|
["day"]=>
|
|
|
|
int(12)
|
|
|
|
["hour"]=>
|
|
|
|
int(10)
|
|
|
|
["minute"]=>
|
|
|
|
int(0)
|
|
|
|
["second"]=>
|
|
|
|
int(0)
|
|
|
|
["fraction"]=>
|
|
|
|
float(0.5)
|
|
|
|
["warning_count"]=>
|
|
|
|
int(0)
|
|
|
|
["warnings"]=>
|
|
|
|
array(0) {
|
|
|
|
}
|
|
|
|
["error_count"]=>
|
|
|
|
int(0)
|
|
|
|
["errors"]=>
|
|
|
|
array(0) {
|
|
|
|
}
|
|
|
|
["is_localtime"]=>
|
|
|
|
bool(false)
|
|
|
|
}
|
|
|
|
array(12) {
|
|
|
|
["year"]=>
|
|
|
|
int(2006)
|
|
|
|
["month"]=>
|
|
|
|
int(12)
|
|
|
|
["day"]=>
|
|
|
|
int(12)
|
|
|
|
["hour"]=>
|
|
|
|
bool(false)
|
|
|
|
["minute"]=>
|
|
|
|
bool(false)
|
|
|
|
["second"]=>
|
|
|
|
bool(false)
|
|
|
|
["fraction"]=>
|
|
|
|
bool(false)
|
|
|
|
["warning_count"]=>
|
|
|
|
int(0)
|
|
|
|
["warnings"]=>
|
|
|
|
array(0) {
|
|
|
|
}
|
|
|
|
["error_count"]=>
|
|
|
|
int(0)
|
|
|
|
["errors"]=>
|
|
|
|
array(0) {
|
|
|
|
}
|
|
|
|
["is_localtime"]=>
|
|
|
|
bool(false)
|
|
|
|
}
|
|
|
|
array(15) {
|
|
|
|
["year"]=>
|
|
|
|
int(2006)
|
|
|
|
["month"]=>
|
|
|
|
int(12)
|
|
|
|
["day"]=>
|
2008-07-30 18:00:44 +00:00
|
|
|
int(1)
|
2006-12-22 13:07:53 +00:00
|
|
|
["hour"]=>
|
|
|
|
bool(false)
|
|
|
|
["minute"]=>
|
|
|
|
bool(false)
|
|
|
|
["second"]=>
|
|
|
|
bool(false)
|
|
|
|
["fraction"]=>
|
|
|
|
bool(false)
|
|
|
|
["warning_count"]=>
|
2008-07-30 18:00:44 +00:00
|
|
|
int(0)
|
2006-12-22 13:07:53 +00:00
|
|
|
["warnings"]=>
|
2008-07-30 18:00:44 +00:00
|
|
|
array(0) {
|
2006-12-22 13:07:53 +00:00
|
|
|
}
|
|
|
|
["error_count"]=>
|
|
|
|
int(1)
|
|
|
|
["errors"]=>
|
|
|
|
array(1) {
|
|
|
|
[7]=>
|
|
|
|
string(20) "Unexpected character"
|
|
|
|
}
|
|
|
|
["is_localtime"]=>
|
|
|
|
bool(true)
|
|
|
|
["zone_type"]=>
|
|
|
|
int(1)
|
|
|
|
["zone"]=>
|
|
|
|
int(720)
|
|
|
|
["is_dst"]=>
|
|
|
|
bool(false)
|
|
|
|
}
|
|
|
|
array(12) {
|
|
|
|
["year"]=>
|
|
|
|
int(2006)
|
|
|
|
["month"]=>
|
|
|
|
int(2)
|
|
|
|
["day"]=>
|
|
|
|
int(30)
|
|
|
|
["hour"]=>
|
|
|
|
bool(false)
|
|
|
|
["minute"]=>
|
|
|
|
bool(false)
|
|
|
|
["second"]=>
|
|
|
|
bool(false)
|
|
|
|
["fraction"]=>
|
|
|
|
bool(false)
|
|
|
|
["warning_count"]=>
|
2008-07-16 07:36:04 +00:00
|
|
|
int(1)
|
2006-12-22 13:07:53 +00:00
|
|
|
["warnings"]=>
|
2008-07-16 07:36:04 +00:00
|
|
|
array(1) {
|
|
|
|
[11]=>
|
|
|
|
string(27) "The parsed date was invalid"
|
2006-12-22 13:07:53 +00:00
|
|
|
}
|
|
|
|
["error_count"]=>
|
|
|
|
int(0)
|
|
|
|
["errors"]=>
|
|
|
|
array(0) {
|
|
|
|
}
|
|
|
|
["is_localtime"]=>
|
|
|
|
bool(false)
|
|
|
|
}
|
|
|
|
array(12) {
|
|
|
|
["year"]=>
|
|
|
|
int(2006)
|
|
|
|
["month"]=>
|
|
|
|
int(3)
|
|
|
|
["day"]=>
|
|
|
|
int(4)
|
|
|
|
["hour"]=>
|
|
|
|
bool(false)
|
|
|
|
["minute"]=>
|
|
|
|
bool(false)
|
|
|
|
["second"]=>
|
|
|
|
bool(false)
|
|
|
|
["fraction"]=>
|
|
|
|
bool(false)
|
|
|
|
["warning_count"]=>
|
|
|
|
int(0)
|
|
|
|
["warnings"]=>
|
|
|
|
array(0) {
|
|
|
|
}
|
|
|
|
["error_count"]=>
|
|
|
|
int(0)
|
|
|
|
["errors"]=>
|
|
|
|
array(0) {
|
|
|
|
}
|
|
|
|
["is_localtime"]=>
|
|
|
|
bool(false)
|
|
|
|
}
|
|
|
|
array(12) {
|
|
|
|
["year"]=>
|
|
|
|
int(2006)
|
|
|
|
["month"]=>
|
|
|
|
int(3)
|
|
|
|
["day"]=>
|
2008-07-30 18:00:44 +00:00
|
|
|
int(1)
|
2006-12-22 13:07:53 +00:00
|
|
|
["hour"]=>
|
|
|
|
bool(false)
|
|
|
|
["minute"]=>
|
|
|
|
bool(false)
|
|
|
|
["second"]=>
|
|
|
|
bool(false)
|
|
|
|
["fraction"]=>
|
|
|
|
bool(false)
|
|
|
|
["warning_count"]=>
|
2008-07-30 18:00:44 +00:00
|
|
|
int(0)
|
2006-12-22 13:07:53 +00:00
|
|
|
["warnings"]=>
|
2008-07-30 18:00:44 +00:00
|
|
|
array(0) {
|
2006-12-22 13:07:53 +00:00
|
|
|
}
|
|
|
|
["error_count"]=>
|
|
|
|
int(0)
|
|
|
|
["errors"]=>
|
|
|
|
array(0) {
|
|
|
|
}
|
|
|
|
["is_localtime"]=>
|
|
|
|
bool(false)
|
|
|
|
}
|
|
|
|
array(15) {
|
|
|
|
["year"]=>
|
|
|
|
bool(false)
|
|
|
|
["month"]=>
|
|
|
|
bool(false)
|
|
|
|
["day"]=>
|
|
|
|
bool(false)
|
|
|
|
["hour"]=>
|
|
|
|
bool(false)
|
|
|
|
["minute"]=>
|
|
|
|
bool(false)
|
|
|
|
["second"]=>
|
|
|
|
bool(false)
|
|
|
|
["fraction"]=>
|
|
|
|
bool(false)
|
|
|
|
["warning_count"]=>
|
|
|
|
int(0)
|
|
|
|
["warnings"]=>
|
|
|
|
array(0) {
|
|
|
|
}
|
|
|
|
["error_count"]=>
|
|
|
|
int(2)
|
|
|
|
["errors"]=>
|
|
|
|
array(2) {
|
|
|
|
[0]=>
|
|
|
|
string(20) "Unexpected character"
|
|
|
|
[1]=>
|
|
|
|
string(20) "Unexpected character"
|
|
|
|
}
|
|
|
|
["is_localtime"]=>
|
|
|
|
bool(true)
|
|
|
|
["zone_type"]=>
|
|
|
|
int(1)
|
|
|
|
["zone"]=>
|
|
|
|
int(180)
|
|
|
|
["is_dst"]=>
|
|
|
|
bool(false)
|
|
|
|
}
|
|
|
|
array(15) {
|
|
|
|
["year"]=>
|
|
|
|
bool(false)
|
|
|
|
["month"]=>
|
|
|
|
bool(false)
|
|
|
|
["day"]=>
|
|
|
|
bool(false)
|
|
|
|
["hour"]=>
|
|
|
|
bool(false)
|
|
|
|
["minute"]=>
|
|
|
|
bool(false)
|
|
|
|
["second"]=>
|
|
|
|
bool(false)
|
|
|
|
["fraction"]=>
|
|
|
|
bool(false)
|
|
|
|
["warning_count"]=>
|
|
|
|
int(0)
|
|
|
|
["warnings"]=>
|
|
|
|
array(0) {
|
|
|
|
}
|
|
|
|
["error_count"]=>
|
|
|
|
int(1)
|
|
|
|
["errors"]=>
|
|
|
|
array(1) {
|
|
|
|
[0]=>
|
|
|
|
string(20) "Unexpected character"
|
|
|
|
}
|
|
|
|
["is_localtime"]=>
|
|
|
|
bool(true)
|
|
|
|
["zone_type"]=>
|
|
|
|
int(1)
|
|
|
|
["zone"]=>
|
|
|
|
int(0)
|
|
|
|
["is_dst"]=>
|
|
|
|
bool(false)
|
|
|
|
}
|
|
|
|
array(12) {
|
|
|
|
["year"]=>
|
|
|
|
bool(false)
|
|
|
|
["month"]=>
|
|
|
|
bool(false)
|
|
|
|
["day"]=>
|
|
|
|
bool(false)
|
|
|
|
["hour"]=>
|
|
|
|
bool(false)
|
|
|
|
["minute"]=>
|
|
|
|
bool(false)
|
|
|
|
["second"]=>
|
|
|
|
bool(false)
|
|
|
|
["fraction"]=>
|
|
|
|
bool(false)
|
|
|
|
["warning_count"]=>
|
|
|
|
int(0)
|
|
|
|
["warnings"]=>
|
|
|
|
array(0) {
|
|
|
|
}
|
|
|
|
["error_count"]=>
|
|
|
|
int(1)
|
|
|
|
["errors"]=>
|
|
|
|
array(1) {
|
|
|
|
[0]=>
|
|
|
|
string(12) "Empty string"
|
|
|
|
}
|
|
|
|
["is_localtime"]=>
|
|
|
|
bool(false)
|
|
|
|
}
|
|
|
|
|
2009-01-10 00:50:45 +00:00
|
|
|
Warning: date_parse() expects parameter 1 to be string, array given in %sdate_parse_001.php on line %d
|
2006-12-22 13:07:53 +00:00
|
|
|
bool(false)
|
|
|
|
Done
|