Doc #75259 [NEW]: getTimestamp and ->format('U') both return 32-bit int
| From: | lewiscowles at me dot com | Date: | Tue, 26 Sep 2017 13:34:39 +0000 |
| Subject: | Doc #75259 [NEW]: getTimestamp and ->format('U') both return 32-bit int | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-14998@lists.php.net to get a copy of this message | ||
From: lewiscowles at me dot com
Operating system: Ubuntu Xenial (64-bit)
PHP version: 7.0.23
Package: Date/time related
Bug Type: Documentation Problem
Bug description:getTimestamp and ->format('U') both return 32-bit int
Description:
------------
I expected to see > 32-bits (I'd really love to know how to get > 32bits
of time-data if this is the expected behaviour)
Test script:
---------------
---
From manual page: http://www.php.net/datetime.gettimestamp
---
<?php
// PHP Get Integer Size (wouldn't expect 32-bit OS to deal with 64-bit
Int's)
var_dump(PHP_INT_SIZE);
// setup
$dt = new DateTime(PHP_INT_MAX << 1);
// should return 64-bit max shifted left once
var_dump(sprintf("%064b", $dt->format('U')));
// should return 64-bit max shifted left once
var_dump(sprintf("%064b", $dt->getTimestamp()));
Expected result:
----------------
// int(8)
// string(64)
"0111111111111111111111111111111111111111111111111111111111111111"
// string(64)
"0111111111111111111111111111111111111111111111111111111111111111"
// Note I may have the zero in the wrong place, can't remember if the
most or least significant bit is supposed to be shifted, but you get the
picture).
Actual result:
--------------
// int(8)
// string(64)
"0000000000000000000000000000000001011001110010100111110111011010"
// string(64)
"0000000000000000000000000000000001011001110010100111110111011010"
--
Edit bug report at https://bugs.php.net/bug.php?id=75259&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75259&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75259&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75259&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=75259&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=75259&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=75259&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=75259&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=75259&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=75259&r=support
Expected behavior: https://bugs.php.net/fix.php?id=75259&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=75259&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=75259&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=75259&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75259&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=75259&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=75259&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=75259&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=75259&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=75259&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=75259&r=mysqlcfg