php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52242 DateTime::diff affects round()
Submitted: 2010-07-03 17:14 UTC Modified: 2011-01-22 08:47 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: hrach dot cz at gmail dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.3.2 OS: win7 x86
Private report: No CVE-ID: None
 [2010-07-03 17:14 UTC] 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
Ů

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-07-03 17:18 UTC] 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 18:01 UTC] pajoye@php.net
-Status: Open +Status: Feedback
 [2010-07-03 18:01 UTC] pajoye@php.net
Does it happen only when the DateTime::diff method is used? I mean: never happened otherwise?
 [2010-07-03 18:12 UTC] hrach dot cz at gmail dot com
-Status: Feedback +Status: Open
 [2010-07-03 18:12 UTC] hrach dot cz at gmail dot com
I have no expiriences with that in other cases. So, yes, it happens only when diff is used.
 [2010-07-03 18:56 UTC] pajoye@php.net
-Status: Open +Status: Feedback
 [2010-07-03 18:56 UTC] pajoye@php.net
Which binary do you use? (vc6, vc9, ts, nts)?
 [2010-07-03 20:49 UTC] hrach dot cz at gmail dot com
-Status: Feedback +Status: Open
 [2010-07-03 20:49 UTC] hrach dot cz at gmail dot com
I use vc6 TS
 [2010-07-03 21:02 UTC] pajoye@php.net
-Status: Open +Status: Feedback
 [2010-07-03 21:02 UTC] pajoye@php.net
Can you try using VC9 please?

This bug is similar to another we have using vc6 crt but does not happen with VC9 (bug in the crt, not in php).
 [2010-07-03 21:12 UTC] hrach dot cz at gmail dot com
-Status: Feedback +Status: Open
 [2010-07-03 21:12 UTC] hrach dot cz at gmail dot com
Yes, after your previous question I tried it and it was ok.
The most confusing thing on vc6 is the fact it sometimes goes right.
 [2011-01-22 08:47 UTC] stas@php.net
-Status: Open +Status: Bogus
 [2011-01-22 08:47 UTC] stas@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jun 02 06:01:28 2024 UTC