summaryrefslogtreecommitdiff
path: root/ext/date/php_date.c
diff options
context:
space:
mode:
authorChristopher Jones <sixd@php.net>2013-09-13 14:10:53 -0700
committerChristopher Jones <sixd@php.net>2013-09-13 14:10:53 -0700
commitd52dbd569fd0f68ec2c79a96f1a3466c71ef549e (patch)
tree229c4412dc163d13a880f2650c1499ea02065e31 /ext/date/php_date.c
parente5678c9b95a68c28f40c43217e299eb22780a526 (diff)
parent9eaffd34c123ae5782054cd32bf6caa50ff2b7d2 (diff)
downloadphp-git-d52dbd569fd0f68ec2c79a96f1a3466c71ef549e.tar.gz
Merge branch 'PHP-5.5' of https://git.php.net/repository/php-src into PHP-5.5
# By Adam Harvey (3) and others # Via Adam Harvey (2) and Michael Wallner (1) * 'PHP-5.5' of https://git.php.net/repository/php-src: fix broken sha2 configure tests Fixed minor bug in test. Move NEWS entries to correct version Fix bug #64782: SplFileObject constructor make $context optional Fix bug #65502: DateTimeImmutable::createFromFormat returns DateTime Fix bug #65548: Comparison for DateTimeImmutable doesn't work Tinker with the wording of the short_open_tag description. Fix NEWS: these commits were after 5.5.4 was branched and will be in 5.5.5. Handle CLI server request headers case insensitively. ensure that the defined interpolation method is used by the generic scaling functions Fixed issue #128 (opcache_invalidate segmentation fault) 5.4.21 now
Diffstat (limited to 'ext/date/php_date.c')
-rw-r--r--ext/date/php_date.c32
1 files changed, 13 insertions, 19 deletions
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index 95c68f1a78..7d3d1d739e 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -480,7 +480,7 @@ const zend_function_entry date_funcs_immutable[] = {
PHP_ME(DateTimeImmutable, __construct, arginfo_date_create, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC)
PHP_ME(DateTime, __wakeup, NULL, ZEND_ACC_PUBLIC)
PHP_ME(DateTimeImmutable, __set_state, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- PHP_ME_MAPPING(createFromFormat, date_create_from_format, arginfo_date_create_from_format, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME_MAPPING(createFromFormat, date_create_immutable_from_format, arginfo_date_create_from_format, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
PHP_ME_MAPPING(getLastErrors, date_get_last_errors, arginfo_date_get_last_errors, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
PHP_ME_MAPPING(format, date_format, arginfo_date_method_format, 0)
PHP_ME_MAPPING(getTimezone, date_timezone_get, arginfo_date_method_timezone_get, 0)
@@ -2142,27 +2142,21 @@ static zval* date_clone_immutable(zval *object TSRMLS_DC)
static int date_object_compare_date(zval *d1, zval *d2 TSRMLS_DC)
{
- if (Z_TYPE_P(d1) == IS_OBJECT && Z_TYPE_P(d2) == IS_OBJECT &&
- instanceof_function(Z_OBJCE_P(d1), date_ce_date TSRMLS_CC) &&
- instanceof_function(Z_OBJCE_P(d2), date_ce_date TSRMLS_CC)) {
- php_date_obj *o1 = zend_object_store_get_object(d1 TSRMLS_CC);
- php_date_obj *o2 = zend_object_store_get_object(d2 TSRMLS_CC);
+ php_date_obj *o1 = zend_object_store_get_object(d1 TSRMLS_CC);
+ php_date_obj *o2 = zend_object_store_get_object(d2 TSRMLS_CC);
- if (!o1->time || !o2->time) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Trying to compare an incomplete DateTime object");
- return 1;
- }
- if (!o1->time->sse_uptodate) {
- timelib_update_ts(o1->time, o1->time->tz_info);
- }
- if (!o2->time->sse_uptodate) {
- timelib_update_ts(o2->time, o2->time->tz_info);
- }
-
- return (o1->time->sse == o2->time->sse) ? 0 : ((o1->time->sse < o2->time->sse) ? -1 : 1);
+ if (!o1->time || !o2->time) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Trying to compare an incomplete DateTime or DateTimeImmutable object");
+ return 1;
+ }
+ if (!o1->time->sse_uptodate) {
+ timelib_update_ts(o1->time, o1->time->tz_info);
+ }
+ if (!o2->time->sse_uptodate) {
+ timelib_update_ts(o2->time, o2->time->tz_info);
}
- return 1;
+ return (o1->time->sse == o2->time->sse) ? 0 : ((o1->time->sse < o2->time->sse) ? -1 : 1);
}
static HashTable *date_object_get_gc(zval *object, zval ***table, int *n TSRMLS_DC)