Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.5.0a4

Bug #13376 setFromDateDiff change source dates
Submitted: 2008-03-11 17:22 UTC Modified: 2008-03-23 19:10 UTC
From: banzai Assigned: c01234
Status: Closed Package: Date (version 1.4.7)
PHP Version: 5.2.5 OS: Linux 10.2
Roadmaps: (Not assigned)    
Subscription  


 [2008-03-11 17:22 UTC] banzai (Lutz Mahle)
Description: ------------ Hello there, i've got a buggy effect by using the Date_Span::setFromDateDiff method. Why change this method the parameter dates and don't use local copies to calculate the span? Test script: --------------- $startDate = new Date( "2008-02-12" ); $endDate = new Date( "2008-03-01" ); print "Days: " . $startDate->format( "%Y-%m-%d" ) . " to " . $endDate->format( "%Y-%m-%d" ) . "\n"; $diff = new Date_Span(); $diff->setFromDateDiff( $startDate, $endDate ); print "Days: " . $startDate->format( "%Y-%m-%d" ) . " to " . $endDate->format( "%Y-%m-%d" ) . "\n"; Expected result: ---------------- Days: 2008-02-12 to 2008-03-01 Days: 2008-02-12 to 2008-03-01 Actual result: -------------- Days: 2008-02-12 to 2008-03-01 Days: 2008-02-11 to 2008-02-29

Comments

 [2008-03-12 05:43 UTC] estigy (G√ľnther Stadler)
> Why change this method the parameter dates and don't use local copies to calculate the span? Because in PHP4 this was exactly what happened internally. Only since PHP5 objects are always passed by reference and this is why we have to experience those side effects. Also see this bug here, it's caused by the same thing: http://pear.php.net/bugs/bug.php?id=12019
 [2008-03-21 05:48 UTC] c01234 (Chuckie Chuck)
This is OK in CVS
 [2008-03-23 19:10 UTC] c01234 (Chuckie Chuck)
Thank you for your bug report. This issue has been fixed in the latest released version of the package, which you can download at http://pear.php.net/get/Date
 [2009-07-06 22:03 UTC] takteek (Spencer Van Hoose)
Sorry if I'm missing something obvious, but as far as I can tell this issue is not fixed in the latest release 1.5.0a1. I am experiencing this problem and just downloaded the package.