php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52062 large timestamps with DateTime::getTimestamp and DateTime::setTimestamp
Submitted: 2010-06-12 05:15 UTC Modified: 2013-06-24 06:34 UTC
Votes:4
Avg. Score:4.0 ± 0.7
Reproduced:2 of 3 (66.7%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: dan at bnet dot lt Assigned: derick (profile)
Status: Closed Package: Date/time related
PHP Version: 5.4.0RC4 OS: Ubuntu i686 2.6.32-22-generic
Private report: No CVE-ID: None
 [2010-06-12 05:15 UTC] dan at bnet dot lt
Description:
------------
DateTime::getTimestamp(), DateTime::setTimestamp() and DateInterval does not work 
with large timestamps (using numbers over x86 integers)

Test script:
---------------
$d = new DateTime('@100000000000');
var_dump($d->format('Y-m-d H:i:s U'));
var_dump($d->getTimestamp());

$d->setTimestamp(100000000000);
var_dump($d->format('Y-m-d H:i:s U'));
var_dump($d->getTimestamp());

$i = new DateInterval('PT100000000000S');
var_dump($i->format('%s'));


Expected result:
----------------
string(32) "5138-11-16 09:46:40 100000000000"
float(100000000000)

string(32) "5138-11-16 09:46:40 100000000000"
float(100000000000)

string(12) "100000000000"

Actual result:
--------------
string(32) "5138-11-16 09:46:40 100000000000"
bool(false)

string(30) "2008-07-11 04:56:32 1215752192"
int(1215752192)

Exception with message 'DateInterval::__construct(): Unknown or bad format 
(PT100000000000S)'

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-06-12 14:58 UTC] felipe@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: derick
 [2011-12-06 06:04 UTC] derick@php.net
Automatic comment from SVN on behalf of derick
Revision: http://svn.php.net/viewvc/?view=revision&revision=320478
Log: - Fixed bug #52062: large timestamps with DateTime::getTimestamp and DateTime::setTimestamp.
 [2011-12-06 06:04 UTC] derick@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 [2011-12-06 06:04 UTC] derick@php.net
-Status: Assigned +Status: Closed
 [2011-12-06 06:20 UTC] derick@php.net
Automatic comment from SVN on behalf of derick
Revision: http://svn.php.net/viewvc/?view=revision&revision=320481
Log: - Fixed bug #53502 (strtotime with timezone memory leak).
- Fixed bug #52062 (large timestamps with DateTime::getTimestamp and
  DateTime::setTimestamp).
- Fixed bug #51994 (date_parse_from_format is parsing invalid date using 'yz'
  format).
- Fixed bug #51223 (Seg fault while creating (by unserialization)
  DatePeriod).
 [2011-12-26 00:03 UTC] stas@php.net
-Status: Closed +Status: Assigned
 [2011-12-26 00:03 UTC] stas@php.net
Still reproduceable for me on Mac OS X in 32-bit mode. Test for bug 52062 fails.
 [2011-12-26 00:04 UTC] stas@php.net
-PHP Version: 5.3.2 +PHP Version: 5.4.0RC4
 [2012-04-10 10:25 UTC] ab@php.net
Automatic comment on behalf of ab
Revision: http://git.php.net/?p=php-src.git;a=commit;h=4ff55e646ab3450e06054b65a351082efe43e473
Log: Fix bug #61609 Test ext\date\tests\bug52062.phpt fails As expressed in the comments http://de.php.net/manual/en/datetime.gettimestamp.php this is the generic 32 bit timestamp issue
 [2012-04-10 10:25 UTC] ab@php.net
Automatic comment on behalf of ab
Revision: http://git.php.net/?p=php-src.git;a=commit;h=fd68d5b13929ff4b2492a024eeaf14d07b3e5dad
Log: Fix bug #61609 Test ext\date\tests\bug52062.phpt fails As expressed in the comments http://de.php.net/manual/en/datetime.gettimestamp.php this is the generic 32 bit timestamp issue
 [2012-04-10 10:25 UTC] ab@php.net
Automatic comment on behalf of ab
Revision: http://git.php.net/?p=php-src.git;a=commit;h=7a2a75d0570e685e3d644e3e4931b92463ef9eb0
Log: Fix bug #61609 Test ext\date\tests\bug52062.phpt fails As expressed in the comments http://de.php.net/manual/en/datetime.gettimestamp.php this is the generic 32 bit timestamp issue
 [2012-04-10 10:39 UTC] ab@php.net
Automatic comment on behalf of ab
Revision: http://git.php.net/?p=php-src.git;a=commit;h=4ff55e646ab3450e06054b65a351082efe43e473
Log: Fix bug #61609 Test ext\date\tests\bug52062.phpt fails As expressed in the comments http://de.php.net/manual/en/datetime.gettimestamp.php this is the generic 32 bit timestamp issue
 [2012-04-10 10:39 UTC] ab@php.net
Automatic comment on behalf of ab
Revision: http://git.php.net/?p=php-src.git;a=commit;h=fd68d5b13929ff4b2492a024eeaf14d07b3e5dad
Log: Fix bug #61609 Test ext\date\tests\bug52062.phpt fails As expressed in the comments http://de.php.net/manual/en/datetime.gettimestamp.php this is the generic 32 bit timestamp issue
 [2012-04-18 09:45 UTC] laruence@php.net
Automatic comment on behalf of ab
Revision: http://git.php.net/?p=php-src.git;a=commit;h=7a2a75d0570e685e3d644e3e4931b92463ef9eb0
Log: Fix bug #61609 Test ext\date\tests\bug52062.phpt fails As expressed in the comments http://de.php.net/manual/en/datetime.gettimestamp.php this is the generic 32 bit timestamp issue
 [2012-04-18 09:47 UTC] laruence@php.net
Automatic comment on behalf of derick
Revision: http://git.php.net/?p=php-src.git;a=commit;h=4c9fad8b362a7d2b6a94b4961e4b2dc037b2766d
Log: - Fixed bug #53502 (strtotime with timezone memory leak). - Fixed bug #52062 (large timestamps with DateTime::getTimestamp and   DateTime::setTimestamp). - Fixed bug #51994 (date_parse_from_format is parsing invalid date using 'yz'   format). - Fixed bug #51223 (Seg fault while creating (by unserialization)   DatePeriod).
 [2012-04-18 09:47 UTC] laruence@php.net
Automatic comment on behalf of derick
Revision: http://git.php.net/?p=php-src.git;a=commit;h=b2b7d5b94314e34f9b2a69e1b7e25aa7dd3e4a5c
Log: - Fixed bug #52062: large timestamps with DateTime::getTimestamp and DateTime::setTimestamp.
 [2012-07-24 23:36 UTC] rasmus@php.net
Automatic comment on behalf of ab
Revision: http://git.php.net/?p=php-src.git;a=commit;h=7a2a75d0570e685e3d644e3e4931b92463ef9eb0
Log: Fix bug #61609 Test ext\date\tests\bug52062.phpt fails As expressed in the comments http://de.php.net/manual/en/datetime.gettimestamp.php this is the generic 32 bit timestamp issue
 [2012-07-24 23:38 UTC] rasmus@php.net
Automatic comment on behalf of derick
Revision: http://git.php.net/?p=php-src.git;a=commit;h=4c9fad8b362a7d2b6a94b4961e4b2dc037b2766d
Log: - Fixed bug #53502 (strtotime with timezone memory leak). - Fixed bug #52062 (large timestamps with DateTime::getTimestamp and   DateTime::setTimestamp). - Fixed bug #51994 (date_parse_from_format is parsing invalid date using 'yz'   format). - Fixed bug #51223 (Seg fault while creating (by unserialization)   DatePeriod).
 [2012-07-24 23:38 UTC] rasmus@php.net
Automatic comment on behalf of derick
Revision: http://git.php.net/?p=php-src.git;a=commit;h=b2b7d5b94314e34f9b2a69e1b7e25aa7dd3e4a5c
Log: - Fixed bug #52062: large timestamps with DateTime::getTimestamp and DateTime::setTimestamp.
 [2012-08-13 17:21 UTC] nikic@php.net
This test currently passes for me (I get a warning for a passing xfail test). So is this fixed? Or depending on OS or something?
 [2013-06-24 06:34 UTC] stas@php.net
-Status: Assigned +Status: Closed
 [2013-06-24 06:34 UTC] stas@php.net
The fix for this bug has been committed.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.

Works for me in 5.4 on both 32-bit and 64-bit, so looks like it's fixed.
 [2013-11-17 09:32 UTC] laruence@php.net
Automatic comment on behalf of ab
Revision: http://git.php.net/?p=php-src.git;a=commit;h=7a2a75d0570e685e3d644e3e4931b92463ef9eb0
Log: Fix bug #61609 Test ext\date\tests\bug52062.phpt fails As expressed in the comments http://de.php.net/manual/en/datetime.gettimestamp.php this is the generic 32 bit timestamp issue
 [2013-11-17 09:34 UTC] laruence@php.net
Automatic comment on behalf of derick
Revision: http://git.php.net/?p=php-src.git;a=commit;h=4c9fad8b362a7d2b6a94b4961e4b2dc037b2766d
Log: - Fixed bug #53502 (strtotime with timezone memory leak). - Fixed bug #52062 (large timestamps with DateTime::getTimestamp and   DateTime::setTimestamp). - Fixed bug #51994 (date_parse_from_format is parsing invalid date using 'yz'   format). - Fixed bug #51223 (Seg fault while creating (by unserialization)   DatePeriod).
 [2013-11-17 09:34 UTC] laruence@php.net
Automatic comment on behalf of derick
Revision: http://git.php.net/?p=php-src.git;a=commit;h=b2b7d5b94314e34f9b2a69e1b7e25aa7dd3e4a5c
Log: - Fixed bug #52062: large timestamps with DateTime::getTimestamp and DateTime::setTimestamp.
 [2014-10-07 23:27 UTC] stas@php.net
Automatic comment on behalf of ab
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=fd68d5b13929ff4b2492a024eeaf14d07b3e5dad
Log: Fix bug #61609 Test ext\date\tests\bug52062.phpt fails As expressed in the comments http://de.php.net/manual/en/datetime.gettimestamp.php this is the generic 32 bit timestamp issue
 [2014-10-07 23:27 UTC] stas@php.net
Automatic comment on behalf of ab
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=4ff55e646ab3450e06054b65a351082efe43e473
Log: Fix bug #61609 Test ext\date\tests\bug52062.phpt fails As expressed in the comments http://de.php.net/manual/en/datetime.gettimestamp.php this is the generic 32 bit timestamp issue
 [2014-10-07 23:38 UTC] stas@php.net
Automatic comment on behalf of ab
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=fd68d5b13929ff4b2492a024eeaf14d07b3e5dad
Log: Fix bug #61609 Test ext\date\tests\bug52062.phpt fails As expressed in the comments http://de.php.net/manual/en/datetime.gettimestamp.php this is the generic 32 bit timestamp issue
 [2014-10-07 23:38 UTC] stas@php.net
Automatic comment on behalf of ab
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=4ff55e646ab3450e06054b65a351082efe43e473
Log: Fix bug #61609 Test ext\date\tests\bug52062.phpt fails As expressed in the comments http://de.php.net/manual/en/datetime.gettimestamp.php this is the generic 32 bit timestamp issue
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 03 17:01:29 2024 UTC