From:
Operating system: Debian Squeeze
PHP version: 5.3SVN-2011-04-21 (snap)
Package: Math related
Bug Type: Bug
Bug description:Division is not preferred to substraction
Description:
------------
When dealing with a MySQL-Datetime Tiemstamp i've encountered the following
Bug which leads to an error resulting in a wrong integer (resulting days).
$mysql is an array containing a mysql datetime at point [6] "2011-06-21"
If $mysql[6] is in the future and time() is the present unix-timestamp
we're getting a wrong result in $remaining (days).
Test script:
---------------
$remaining = floor(strtotime(str_replace('-','',$mysql[6])) -
time()/(60*60*24));
Expected result:
----------------
29
Actual result:
--------------
1305920914
--
Edit bug report at http://bugs.php.net/bug.php?id=54582&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=54582&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=54582&r=trysnapshot53
Try a snapshot (trunk):
http://bugs.php.net/fix.php?id=54582&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=54582&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=54582&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=54582&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=54582&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=54582&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=54582&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=54582&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=54582&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=54582&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=54582&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=54582&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54582&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=54582&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=54582&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=54582&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=54582&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=54582&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=54582&r=mysqlcfg