php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51894 DateTime::Diff breaks range()
Submitted: 2010-05-23 22:34 UTC Modified: 2013-02-18 00:34 UTC
Votes:8
Avg. Score:4.4 ± 0.9
Reproduced:8 of 8 (100.0%)
Same Version:1 (12.5%)
Same OS:6 (75.0%)
From: ronald dot fischer at ummanzer dot de Assigned:
Status: No Feedback Package: Date/time related
PHP Version: 5.3.2 OS: Windows 7 Home Premium 64bit
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2010-05-23 22:34 UTC] ronald dot fischer at ummanzer dot de
Description:
------------
After calling DateTime::Diff() the first call to range() fails and issues a warning.



Test script:
---------------
date_default_timezone_set('Europe/Paris');

$dt = new DateTime('2010-10-10');
$dt->diff(new DateTime('2010-12-12'));
range(0,-1,1);

Expected result:
----------------
array(2) { [0]=> int(0) [1]=> int(-1) }

Actual result:
--------------
Warning: range(): step exceeds the specified range
bool(false)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-05-24 11:44 UTC] derick@php.net
-Status: Open +Status: Feedback
 [2010-05-24 11:44 UTC] derick@php.net
Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/
 [2011-08-10 09:23 UTC] chris at gedrim dot co dot uk
I'm experiencing this issue with php v5.3.5 on Windows 7 Pro x64.

Just about to try the snapshot suggested.
 [2011-08-10 10:35 UTC] chris at gedrim dot co dot uk
I can confirm v5.3.6 fixes the problem.
 [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 Oct 24 03:03:35 2021 UTC