Bug #52242 [Fbk->Opn]: DateTime::diff affects round()

From: Date: Sat, 03 Jul 2010 16:12:18 +0000
Subject: Bug #52242 [Fbk->Opn]: DateTime::diff affects round()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-152058@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=52242&edit=1 ID: 52242 User updated by: hrach dot cz at gmail dot com Reported by: hrach dot cz at gmail dot com Summary: DateTime::diff affects round() -Status: Feedback +Status: Open Type: Bug Package: Date/time related Operating System: win7 x86 PHP Version: 5.3.2 New Comment: I have no expiriences with that in other cases. So, yes, it happens only when diff is used. Previous Comments: ------------------------------------------------------------------------ [2010-07-03 18:01:02] pajoye@php.net Does it happen only when the DateTime::diff method is used? I mean: never happened otherwise? ------------------------------------------------------------------------ [2010-07-03 17:18:49] hrach dot cz at gmail dot com I copied old version of definition $t, should be: $t = new DateTime('2010-08-03'); ------------------------------------------------------------------------ [2010-07-03 17:14:58] hrach dot cz at gmail dot com Description: ------------ If I use diff method (doesn't matter on which variable), usually (unfortunatelly not allways) round function returned some char (@, U, :, <, ...) I was not able to realize cases. :( Test script: --------------- <?php $t = new DateTime(); $s = new DateTime('2010-08-01'); $diff = $t->diff($s, true)->format('%d'); echo $diff ."\n"; $var = 98232923; $mod = 82342; $dur = round($var / $mod); echo $dur; Expected result: ---------------- 2 1193 Actual result: -------------- 2 Å® ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=52242&edit=1

« previous php.bugs (#152058) next »