FAQ
Edit report at http://pear.php.net/bugs/bug.php?id=13376&edit=1

ID: 13376
Comment by: admin@spencervanhoose.com
Reported By: buckaroo_29 at yahoo dot de
Summary: setFromDateDiff change source dates
Status: Closed
Type: Bug
Package: Date
Operating System: Linux 10.2
Package Version: 1.4.7
PHP Version: 5.2.5
Assigned To: c01234
Roadmap Versions:
New Comment:

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.


Previous Comments:
------------------------------------------------------------------------

[2008-03-23 19:10:33] c01234

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

------------------------------------------------------------------------

[2008-03-21 05:48:25] c01234

This is OK in CVS

------------------------------------------------------------------------

[2008-03-12 05:43:36] estigy
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-11 17:22:21] banzai

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

------------------------------------------------------------------------

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedJul 6, '09 at 9:05p
activeJul 6, '09 at 9:05p
posts1
users1
websitepear.php.net

1 user in discussion

Admin: 1 post

People

Translate

site design / logo © 2022 Grokbase