php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45358 var_dump(strtotime('1214431948'));
Submitted: 2008-06-25 19:50 UTC Modified: 2008-06-25 21:07 UTC
From: viorel dot irimia at gmail dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.2.6 OS: Debian GNU/Linux 4.0
Private report: No CVE-ID: None
 [2008-06-25 19:50 UTC] viorel dot irimia at gmail dot com
Description:
------------
It seems that var_dump(strtotime('1214431948')); is returning int(-678980717) instead timestamp / false / -1
I belive is an overflow somewhere...

Version:
PHP Version 5.2.0-8+etch11
Build Date 	May 10 2008 10:31:53
Linux 2.6.18-6-686, debian 4.0


Reproduce code:
---------------
var_dump(strtotime('1214431948'));
var_dump(strtotime('1214431946'));

Expected result:
----------------
false | -1
false | -1

Actual result:
--------------
int(-678980717)
int(-742139117)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-06-25 20:28 UTC] smlerman at gmail dot com
'1214431948' is being understood as
'HHiissYYYY'

var_dump(date('Y-m-d H:i:s', strtotime('1214431947'))); will show you what's happening.
 [2008-06-25 20:46 UTC] viorel dot irimia at gmail dot com
This is not suppose to happen.

From PHP manual: 
Return Values:
Returns a timestamp on success, FALSE otherwise. Previous to PHP 5.1.0, this function would return -1 on failure.

A timestamp is an unsigned integer. Of course in PHP there is no such thing. I still belive is an integer overflow.
 [2008-06-25 21:07 UTC] derick@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

Duplicate of #45359
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 20 16:01:35 2024 UTC