|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52920 Multiple datetime affects divisions
Submitted: 2010-09-24 17:25 UTC Modified: 2013-02-18 00:34 UTC
Avg. Score:4.6 ± 0.7
Reproduced:5 of 6 (83.3%)
Same Version:2 (40.0%)
Same OS:2 (40.0%)
From: michael at nerdalert dot biz Assigned:
Status: No Feedback Package: Date/time related
PHP Version: 5.3.3 OS: Windows Server 2008 R2 Enterpris
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: michael at nerdalert dot biz
New email:
PHP Version: OS:


 [2010-09-24 17:25 UTC] michael at nerdalert dot biz
The result of this equation (echo 240 / 23;) is NAN in each occurrence when I run DateTime class before the equation. The datetime class needs to be run multiple times to get the NAN result (for ($a=0;$a<2;$a++){). 

Test script:
for ($a=0;$a<2;$a++){
	$lastResponse = date("Y-m-d");	
	$noResponse = date("Y-m-d");	
	$dateCreated = new DateTime(date("Y-m-d", strtotime($lastResponse)));
	$dateNotCreated = new DateTime(date("Y-m-d", strtotime($noResponse)));
	$today = new DateTime(date("Y-m-d"));
		$diff = $today->diff($dateCreated);
		$diff = $today->diff($dateNotCreated);
echo 240 / 23;

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-09-24 17:27 UTC] michael at nerdalert dot biz
-Summary: Division equations are overridden +Summary: Multiple datetime affects divisions
 [2010-09-24 17:27 UTC] michael at nerdalert dot biz
Changing the title only
 [2010-09-29 14:02 UTC]
-Status: Open +Status: Feedback
 [2010-09-29 14:02 UTC]
I can't reproduce this with PHP 5.3.3.

What binaries are you using? (thread safety or not, vc6 or vc9)
 [2013-02-18 00:34 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Dec 05 14:03:37 2021 UTC