summaryrefslogtreecommitdiff
path: root/ext/date/php_date.c
diff options
context:
space:
mode:
authorAaron Piotrowski <aaron@trowski.com>2016-07-03 22:42:10 -0500
committerAaron Piotrowski <aaron@trowski.com>2016-07-03 22:42:10 -0500
commitd9a9cf8ecaef891b2369969e9efe9f6261359158 (patch)
tree04bcc83b3c9be1924007e007e1f508f7229af7ab /ext/date/php_date.c
parent583386d59e6b362fe49e51594718a109d0c0cc2f (diff)
parentc2b29a58bc0916e248ba2584564558097b16b51f (diff)
downloadphp-git-d9a9cf8ecaef891b2369969e9efe9f6261359158.tar.gz
Merge branch 'master' into iterable
Diffstat (limited to 'ext/date/php_date.c')
-rw-r--r--ext/date/php_date.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index e780b2ee6b..5e9c15c19d 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -1071,7 +1071,8 @@ char *php_date_short_day_name(timelib_sll y, timelib_sll m, timelib_sll d)
static zend_string *date_format(char *format, size_t format_len, timelib_time *t, int localtime)
{
smart_str string = {0};
- int i, length = 0;
+ size_t i;
+ int length = 0;
char buffer[97];
timelib_time_offset *offset = NULL;
timelib_sll isoweek, isoyear;
@@ -2013,6 +2014,7 @@ static void date_register_classes(void) /* {{{ */
date_object_handlers_immutable.clone_obj = date_object_clone_date;
date_object_handlers_immutable.compare_objects = date_object_compare_date;
date_object_handlers_immutable.get_properties = date_object_get_properties;
+ date_object_handlers_immutable.get_gc = date_object_get_gc;
zend_class_implements(date_ce_immutable, 1, date_ce_interface);
INIT_CLASS_ENTRY(ce_timezone, "DateTimeZone", date_funcs_timezone);
@@ -2170,7 +2172,7 @@ static HashTable *date_object_get_properties(zval *object) /* {{{ */
props = zend_std_get_properties(object);
- if (!dateobj->time || GC_G(gc_active)) {
+ if (!dateobj->time) {
return props;
}
@@ -3098,7 +3100,7 @@ PHP_METHOD(DateTimeImmutable, modify)
RETURN_FALSE;
}
- ZVAL_COPY_VALUE(return_value, &new_object);
+ ZVAL_OBJ(return_value, Z_OBJ(new_object));
}
/* }}} */
@@ -3149,7 +3151,7 @@ PHP_METHOD(DateTimeImmutable, add)
date_clone_immutable(object, &new_object);
php_date_add(&new_object, interval, return_value);
- ZVAL_COPY_VALUE(return_value, &new_object);
+ ZVAL_OBJ(return_value, Z_OBJ(new_object));
}
/* }}} */
@@ -3205,7 +3207,7 @@ PHP_METHOD(DateTimeImmutable, sub)
date_clone_immutable(object, &new_object);
php_date_sub(&new_object, interval, return_value);
- ZVAL_COPY_VALUE(return_value, &new_object);
+ ZVAL_OBJ(return_value, Z_OBJ(new_object));
}
/* }}} */
@@ -3309,7 +3311,7 @@ PHP_METHOD(DateTimeImmutable, setTimezone)
date_clone_immutable(object, &new_object);
php_date_timezone_set(&new_object, timezone_object, return_value);
- ZVAL_COPY_VALUE(return_value, &new_object);
+ ZVAL_OBJ(return_value, Z_OBJ(new_object));
}
/* }}} */
@@ -3393,7 +3395,7 @@ PHP_METHOD(DateTimeImmutable, setTime)
date_clone_immutable(object, &new_object);
php_date_time_set(&new_object, h, i, s, return_value);
- ZVAL_COPY_VALUE(return_value, &new_object);
+ ZVAL_OBJ(return_value, Z_OBJ(new_object));
}
/* }}} */
@@ -3442,7 +3444,7 @@ PHP_METHOD(DateTimeImmutable, setDate)
date_clone_immutable(object, &new_object);
php_date_date_set(&new_object, y, m, d, return_value);
- ZVAL_COPY_VALUE(return_value, &new_object);
+ ZVAL_OBJ(return_value, Z_OBJ(new_object));
}
/* }}} */
@@ -3495,7 +3497,7 @@ PHP_METHOD(DateTimeImmutable, setISODate)
date_clone_immutable(object, &new_object);
php_date_isodate_set(&new_object, y, w, d, return_value);
- ZVAL_COPY_VALUE(return_value, &new_object);
+ ZVAL_OBJ(return_value, Z_OBJ(new_object));
}
/* }}} */
@@ -3542,7 +3544,7 @@ PHP_METHOD(DateTimeImmutable, setTimestamp)
date_clone_immutable(object, &new_object);
php_date_timestamp_set(&new_object, timestamp, return_value);
- ZVAL_COPY_VALUE(return_value, &new_object);
+ ZVAL_OBJ(return_value, Z_OBJ(new_object));
}
/* }}} */
@@ -4216,7 +4218,8 @@ PHP_FUNCTION(date_interval_create_from_date_string)
static zend_string *date_interval_format(char *format, size_t format_len, timelib_rel_time *t)
{
smart_str string = {0};
- int i, length, have_format_spec = 0;
+ size_t i;
+ int length, have_format_spec = 0;
char buffer[33];
if (!format_len) {
@@ -4851,7 +4854,7 @@ static HashTable *date_object_get_properties_period(zval *object) /* {{{ */
props = zend_std_get_properties(object);
- if (!period_obj->start || GC_G(gc_active)) {
+ if (!period_obj->start) {
return props;
}