- MFH: Fixed bug #45696 (Not all DateTime methods allow method chaining).

This commit is contained in:
Derick Rethans 2008-08-03 16:45:15 +00:00
parent c7cb6f5480
commit ad10607c33
2 changed files with 20 additions and 11 deletions

1
NEWS
View File

@ -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

View File

@ -2825,23 +2825,29 @@ PHP_FUNCTION(date_add)
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 @@ PHP_FUNCTION(date_sub)
timelib_update_ts(dateobj->time, NULL);
timelib_update_from_sse(dateobj->time);
RETURN_ZVAL(object, 1, 0);
}
/* }}} */