derick          Sun Aug  3 16:45:16 2008 UTC

  Modified files:              (Branch: PHP_5_3)
    /php-src    NEWS 
    /php-src/ext/date   php_date.c 
  Log:
  - MFH: Fixed bug #45696 (Not all DateTime methods allow method chaining).
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.244&r2=1.2027.2.547.2.965.2.245&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.965.2.244 
php-src/NEWS:1.2027.2.547.2.965.2.245
--- php-src/NEWS:1.2027.2.547.2.965.2.244       Sun Aug  3 12:22:20 2008
+++ php-src/NEWS        Sun Aug  3 16:45:14 2008
@@ -1,6 +1,7 @@
 PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? ??? 200?, PHP 5.3.0 Alpha 2
+- Fixed bug #45696 (Not all DateTime methods allow method chaining). (Derick)
 - Fixed bug #45545 (DateInterval has a limitation of 4 chars for ISO
   durations). (Derick)
 - Fixed bug #44100 (Inconsistent handling of static array declarations with
http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.43.2.45.2.51.2.52&r2=1.43.2.45.2.51.2.53&diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.52 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.53
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.52     Wed Jul 30 18:00:22 2008
+++ php-src/ext/date/php_date.c Sun Aug  3 16:45:15 2008
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.52 2008/07/30 18:00:22 derick Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.53 2008/08/03 16:45:15 derick Exp $ */
 
 #include "php.h"
 #include "php_streams.h"
@@ -2825,23 +2825,29 @@
        intobj = (php_interval_obj *) zend_object_store_get_object(interval 
TSRMLS_CC);
        DATE_CHECK_INITIALIZED(intobj->initialized, DateInterval);
 
-       if (intobj->diff->invert) {
-               bias = -1;
-       }
 
-       dateobj->time->relative.y = intobj->diff->y * bias;
-       dateobj->time->relative.m = intobj->diff->m * bias;
-       dateobj->time->relative.d = intobj->diff->d * bias;
-       dateobj->time->relative.h = intobj->diff->h * bias;
-       dateobj->time->relative.i = intobj->diff->i * bias;
-       dateobj->time->relative.s = intobj->diff->s * bias;
+       if (intobj->diff->have_weekday_relative || 
intobj->diff->have_special_relative) {
+               memcpy(&dateobj->time->relative, intobj->diff, sizeof(struct 
timelib_rel_time));
+       } else {
+               if (intobj->diff->invert) {
+                       bias = -1;
+               }
+               dateobj->time->relative.y = intobj->diff->y * bias;
+               dateobj->time->relative.m = intobj->diff->m * bias;
+               dateobj->time->relative.d = intobj->diff->d * bias;
+               dateobj->time->relative.h = intobj->diff->h * bias;
+               dateobj->time->relative.i = intobj->diff->i * bias;
+               dateobj->time->relative.s = intobj->diff->s * bias;
+               dateobj->time->relative.weekday = 0;
+               dateobj->time->relative.have_weekday_relative = 0;
+       }
        dateobj->time->have_relative = 1;
-       dateobj->time->relative.weekday = 0;
-       dateobj->time->relative.have_weekday_relative = 0;
        dateobj->time->sse_uptodate = 0;
 
        timelib_update_ts(dateobj->time, NULL);
        timelib_update_from_sse(dateobj->time);
+
+       RETURN_ZVAL(object, 1, 0);
 }
 /* }}} */
 
@@ -2880,6 +2886,8 @@
 
        timelib_update_ts(dateobj->time, NULL);
        timelib_update_from_sse(dateobj->time);
+
+       RETURN_ZVAL(object, 1, 0);
 }
 /* }}} */
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to