Bug #68988 [Opn->Nab]: strtotime returns beyond the expected
| From: | derick@php.net | Date: | Thu, 05 Feb 2015 10:22:42 +0000 |
| Subject: | Bug #68988 [Opn->Nab]: strtotime returns beyond the expected | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-190476@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=68988&edit=1
ID: 68988
Updated by: derick@php.net
Reported by: wanting_e at 163 dot com
Summary: strtotime returns beyond the expected
-Status: Open
+Status: Not a bug
Type: Bug
Package: Scripting Engine problem
Operating System: ubuntu 13.04
PHP Version: 5.5.21
Block user comment: N
Private report: N
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
The parser tries to figure out what you're trying to do. That fails in the first instance:
php -r 'print_r(date_parse("1423122337"));'
Array
(
[year] => 1423
[month] => 12
[day] => 23
[hour] =>
[minute] =>
[second] =>
[fraction] =>
[warning_count] => 0
[warnings] => Array
(
)
[error_count] => 2
[errors] => Array
(
[8] => Unexpected character
[9] => Unexpected character
)
[is_localtime] =>
)
But succeeds in the second:
php -r 'print_r(date_parse("1738598400"));'
Array
(
[year] => 8400
[month] =>
[day] =>
[hour] => 17
[minute] => 38
[second] => 59
[fraction] => 0
[warning_count] => 0
[warnings] => Array
(
)
[error_count] => 0
[errors] => Array
(
)
[is_localtime] =>
)
Previous Comments:
------------------------------------------------------------------------
[2015-02-05 09:42:56] wanting_e at 163 dot com
Description:
------------
I passed two different timestamp to strtotime() function.
I expected both of them will returns false, but the second one returns a big int!
Test script:
---------------
<?php
date_default_timezone_set("Asia/Shanghai");
echo date('Y-m-d H:i:s', 1423122337) . '<br/>'; //2015-02-05 15:45:37
echo date('Y-m-d H:i:s', 1738598400) . '<br/>'; //2025-02-04 00:00:00
var_dump(strtotime('1423122337')); //bool(false)
var_dump(strtotime('1738598400')); //int(202914236339)
Expected result:
----------------
2015-02-05 15:45:37
2025-02-04 00:00:00
bool(false)
bool(false)
Actual result:
--------------
2015-02-05 15:45:37
2025-02-04 00:00:00
bool(false)
int(202914236339)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=68988&edit=1