diff options
Diffstat (limited to 'php-wip2.patch')
-rw-r--r-- | php-wip2.patch | 93 |
1 files changed, 0 insertions, 93 deletions
diff --git a/php-wip2.patch b/php-wip2.patch deleted file mode 100644 index fcea691..0000000 --- a/php-wip2.patch +++ /dev/null @@ -1,93 +0,0 @@ -From 5137cb5f0ccdeb78d6db25f6045b2c520463a38f Mon Sep 17 00:00:00 2001 -From: Derick Rethans <github@derickrethans.nl> -Date: Thu, 2 Jan 2014 12:45:48 +0000 -Subject: [PATCH] Fixed (some of) add/sub. - -This worked in PHP 5.4 already, but with the introduction of DateTimeImmutable -this code was not correctly merged. ---- - ext/date/php_date.c | 48 ++++++++---------------------------------------- - 1 file changed, 8 insertions(+), 40 deletions(-) - -diff --git a/ext/date/php_date.c b/ext/date/php_date.c -index cd3bf74..d96428d 100644 ---- a/ext/date/php_date.c -+++ b/ext/date/php_date.c -@@ -3137,33 +3137,16 @@ static void php_date_add(zval *object, zval *interval, zval *return_value TSRMLS - { - php_date_obj *dateobj; - php_interval_obj *intobj; -- int bias = 1; -+ timelib_time *new_time; - - dateobj = (php_date_obj *) zend_object_store_get_object(object TSRMLS_CC); - DATE_CHECK_INITIALIZED(dateobj->time, DateTime); - intobj = (php_interval_obj *) zend_object_store_get_object(interval TSRMLS_CC); - DATE_CHECK_INITIALIZED(intobj->initialized, DateInterval); - -- 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; -- } -- memset(&dateobj->time->relative, 0, sizeof(struct timelib_rel_time)); -- 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->have_relative = 1; -- dateobj->time->sse_uptodate = 0; -- -- timelib_update_ts(dateobj->time, NULL); -- timelib_update_from_sse(dateobj->time); -- dateobj->time->have_relative = 0; -+ new_time = timelib_add(dateobj->time, intobj->diff); -+ timelib_time_dtor(dateobj->time); -+ dateobj->time = new_time; - } - - /* {{{ proto DateTime date_add(DateTime object, DateInterval interval) -@@ -3204,7 +3187,7 @@ static void php_date_sub(zval *object, zval *interval, zval *return_value TSRMLS - { - php_date_obj *dateobj; - php_interval_obj *intobj; -- int bias = 1; -+ timelib_time *new_time; - - dateobj = (php_date_obj *) zend_object_store_get_object(object TSRMLS_CC); - DATE_CHECK_INITIALIZED(dateobj->time, DateTime); -@@ -3216,24 +3199,9 @@ static void php_date_sub(zval *object, zval *interval, zval *return_value TSRMLS - return; - } - -- if (intobj->diff->invert) { -- bias = -1; -- } -- -- memset(&dateobj->time->relative, 0, sizeof(struct timelib_rel_time)); -- dateobj->time->relative.y = 0 - (intobj->diff->y * bias); -- dateobj->time->relative.m = 0 - (intobj->diff->m * bias); -- dateobj->time->relative.d = 0 - (intobj->diff->d * bias); -- dateobj->time->relative.h = 0 - (intobj->diff->h * bias); -- dateobj->time->relative.i = 0 - (intobj->diff->i * bias); -- dateobj->time->relative.s = 0 - (intobj->diff->s * bias); -- dateobj->time->have_relative = 1; -- dateobj->time->sse_uptodate = 0; -- -- timelib_update_ts(dateobj->time, NULL); -- timelib_update_from_sse(dateobj->time); -- -- dateobj->time->have_relative = 0; -+ new_time = timelib_sub(dateobj->time, intobj->diff); -+ timelib_time_dtor(dateobj->time); -+ dateobj->time = new_time; - } - - /* {{{ proto DateTime date_sub(DateTime object, DateInterval interval) --- -1.8.4.3 - |