derick Sun Aug 3 16:44:31 2008 UTC Modified files: /php-src/ext/date php_date.c Log: - Fixed bug #45696 (Not all DateTime methods allow method chaining). http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.203&r2=1.204&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.203 php-src/ext/date/php_date.c:1.204 --- php-src/ext/date/php_date.c:1.203 Wed Jul 30 17:48:20 2008 +++ php-src/ext/date/php_date.c Sun Aug 3 16:44:31 2008 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_date.c,v 1.203 2008/07/30 17:48:20 derick Exp $ */ +/* $Id: php_date.c,v 1.204 2008/08/03 16:44:31 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -2992,23 +2992,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); } /* }}} */ @@ -3047,6 +3053,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