|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2010-05-06 12:35 UTC] thalamicek at gmail dot com
Description:
------------
When using function date_diff or DateTime::diff, next operation (math, print etc.)
with variable type float fails. I got results as float(>.J), but only for first
operation. This issue can persists to next script process(first contains date_diff
function, next contains operation with float variable)
PHP ver 5.3.1
Test script:
---------------
$a = 141.4;
var_dump($a);
$datetime1 = new DateTime('2009-10-11');
$datetime2 = new DateTime('2009-10-13');
$datetime1->diff($datetime2);
var_dump($a);
var_dump($a);
Expected result:
----------------
float(141.4) float(141.4) float(141.4)
Actual result:
--------------
float(141.4) float(>.J) float(141.4)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 07:00:01 2025 UTC |
A hilarious workaround until this is fixed: $test = new DateTime("2007"); $test->diff(new DateTime("2008")); print_r(3 / 2, 1); // trigger bug, do nothing, resume print 1000 / 3;