diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 0a02a70f6266a..ed66a4a4b9a70 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -2045,6 +2045,11 @@ static zend_object *date_object_clone_interval(zend_object *this_ptr) /* {{{ */ php_interval_obj *new_obj = php_interval_obj_from_obj(date_object_new_interval(old_obj->std.ce)); zend_objects_clone_members(&new_obj->std, &old_obj->std); + new_obj->civil_or_wall = old_obj->civil_or_wall; + new_obj->from_string = old_obj->from_string; + if (old_obj->date_string) { + new_obj->date_string = zend_string_copy(old_obj->date_string); + } new_obj->initialized = old_obj->initialized; if (old_obj->diff) { new_obj->diff = timelib_rel_time_clone(old_obj->diff); @@ -2061,16 +2066,17 @@ static HashTable *date_object_get_gc_interval(zend_object *object, zval **table, return zend_std_get_properties(object); } /* }}} */ -static HashTable *date_object_get_properties_interval(zend_object *object) /* {{{ */ +static void date_interval_object_to_hash(php_interval_obj *intervalobj, HashTable *props) { - HashTable *props; zval zv; - php_interval_obj *intervalobj; - intervalobj = php_interval_obj_from_obj(object); - props = zend_std_get_properties(object); - if (!intervalobj->initialized) { - return props; + /* Records whether this is a special relative interval that needs to be recreated from a string */ + if (intervalobj->from_string) { + ZVAL_BOOL(&zv, (zend_bool)intervalobj->from_string); + zend_hash_str_update(props, "from_string", strlen("from_string"), &zv); + ZVAL_STR_COPY(&zv, intervalobj->date_string); + zend_hash_str_update(props, "date_string", strlen("date_string"), &zv); + return; } #define PHP_DATE_INTERVAL_ADD_PROPERTY(n,f) \ @@ -2085,9 +2091,6 @@ static HashTable *date_object_get_properties_interval(zend_object *object) /* {{ PHP_DATE_INTERVAL_ADD_PROPERTY("s", s); ZVAL_DOUBLE(&zv, (double)intervalobj->diff->us / 1000000.0); zend_hash_str_update(props, "f", sizeof("f") - 1, &zv); - PHP_DATE_INTERVAL_ADD_PROPERTY("weekday", weekday); - PHP_DATE_INTERVAL_ADD_PROPERTY("weekday_behavior", weekday_behavior); - PHP_DATE_INTERVAL_ADD_PROPERTY("first_last_day_of", first_last_day_of); PHP_DATE_INTERVAL_ADD_PROPERTY("invert", invert); if (intervalobj->diff->days != -99999) { PHP_DATE_INTERVAL_ADD_PROPERTY("days", days); @@ -2095,10 +2098,24 @@ static HashTable *date_object_get_properties_interval(zend_object *object) /* {{ ZVAL_FALSE(&zv); zend_hash_str_update(props, "days", sizeof("days")-1, &zv); } - PHP_DATE_INTERVAL_ADD_PROPERTY("special_type", special.type); - PHP_DATE_INTERVAL_ADD_PROPERTY("special_amount", special.amount); - PHP_DATE_INTERVAL_ADD_PROPERTY("have_weekday_relative", have_weekday_relative); - PHP_DATE_INTERVAL_ADD_PROPERTY("have_special_relative", have_special_relative); + ZVAL_BOOL(&zv, (zend_bool)intervalobj->from_string); + zend_hash_str_update(props, "from_string", strlen("from_string"), &zv); + +#undef PHP_DATE_INTERVAL_ADD_PROPERTY +} + +static HashTable *date_object_get_properties_interval(zend_object *object) /* {{{ */ +{ + HashTable *props; + php_interval_obj *intervalobj; + + intervalobj = php_interval_obj_from_obj(object); + props = zend_std_get_properties(object); + if (!intervalobj->initialized) { + return props; + } + + date_interval_object_to_hash(intervalobj, props); return props; } /* }}} */ @@ -2166,6 +2183,10 @@ static void date_object_free_storage_interval(zend_object *object) /* {{{ */ { php_interval_obj *intern = php_interval_obj_from_obj(object); + if (intern->date_string) { + zend_string_release(intern->date_string); + intern->date_string = NULL; + } timelib_rel_time_dtor(intern->diff); zend_object_std_dtor(&intern->std); } /* }}} */ @@ -3082,7 +3103,7 @@ static void php_date_sub(zval *object, zval *interval, zval *return_value) /* {{ intobj = Z_PHPINTERVAL_P(interval); DATE_CHECK_INITIALIZED(intobj->initialized, DateInterval); - if (intobj->diff->have_special_relative) { + if (intobj->diff->have_weekday_relative || intobj->diff->have_special_relative) { php_error_docref(NULL, E_WARNING, "Only non-special relative time specifications are supported for subtraction"); return; } @@ -4092,6 +4113,41 @@ PHP_METHOD(DateInterval, __construct) static void php_date_interval_initialize_from_hash(zval **return_value, php_interval_obj **intobj, HashTable *myht) /* {{{ */ { + /* If ->diff is already set, then we need to free it first */ + if ((*intobj)->diff) { + timelib_rel_time_dtor((*intobj)->diff); + } + + /* If we have a date_string, use that instead */ + zval *date_str = zend_hash_str_find(myht, "date_string", strlen("date_string")); + if (date_str && Z_TYPE_P(date_str) == IS_STRING) { + timelib_time *time; + timelib_error_container *err = NULL; + + time = timelib_strtotime(Z_STRVAL_P(date_str), Z_STRLEN_P(date_str), &err, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper); + + if (err->error_count > 0) { + php_error_docref(NULL, + E_WARNING, + "Unknown or bad format (%s) at position %d (%c) while unserializing: %s", + Z_STRVAL_P(date_str), + err->error_messages[0].position, + err->error_messages[0].character ? err->error_messages[0].character : ' ', err->error_messages[0].message); + } + + (*intobj)->diff = timelib_rel_time_clone(&time->relative); + (*intobj)->initialized = 1; + (*intobj)->civil_or_wall = PHP_DATE_CIVIL; + (*intobj)->from_string = true; + (*intobj)->date_string = zend_string_copy(Z_STR_P(date_str)); + + timelib_time_dtor(time); + timelib_error_container_dtor(err); + + return; + } + + /* Set new value */ (*intobj)->diff = timelib_rel_time_ctor(); #define PHP_DATE_INTERVAL_READ_PROPERTY(element, member, itype, def) \ @@ -4170,6 +4226,7 @@ static void php_date_interval_initialize_from_hash(zval **return_value, php_inte (*intobj)->civil_or_wall = val; } } + (*intobj)->initialized = 1; } /* }}} */ @@ -4192,6 +4249,44 @@ PHP_METHOD(DateInterval, __set_state) } /* }}} */ +/* {{{ */ +PHP_METHOD(DateInterval, __serialize) +{ + zval *object = ZEND_THIS; + php_interval_obj *intervalobj; + HashTable *myht; + + ZEND_PARSE_PARAMETERS_NONE(); + + intervalobj = Z_PHPINTERVAL_P(object); + DATE_CHECK_INITIALIZED(intervalobj->initialized, DateInterval); + + array_init(return_value); + myht = Z_ARRVAL_P(return_value); + date_interval_object_to_hash(intervalobj, myht); +} +/* }}} */ + + +/* {{{ */ +PHP_METHOD(DateInterval, __unserialize) +{ + zval *object = ZEND_THIS; + php_interval_obj *intervalobj; + zval *array; + HashTable *myht; + + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ARRAY(array) + ZEND_PARSE_PARAMETERS_END(); + + intervalobj = Z_PHPINTERVAL_P(object); + myht = Z_ARRVAL_P(array); + + php_date_interval_initialize_from_hash(&object, &intervalobj, myht); +} +/* }}} */ + /* {{{ */ PHP_METHOD(DateInterval, __wakeup) { @@ -4235,6 +4330,8 @@ PHP_FUNCTION(date_interval_create_from_date_string) diobj->diff = timelib_rel_time_clone(&time->relative); diobj->initialized = 1; diobj->civil_or_wall = PHP_DATE_CIVIL; + diobj->from_string = true; + diobj->date_string = zend_string_copy(time_str); cleanup: timelib_time_dtor(time); diff --git a/ext/date/php_date.h b/ext/date/php_date.h index c30d34d3aa76a..d18529f10d30f 100644 --- a/ext/date/php_date.h +++ b/ext/date/php_date.h @@ -72,6 +72,8 @@ static inline php_timezone_obj *php_timezone_obj_from_obj(zend_object *obj) { struct _php_interval_obj { timelib_rel_time *diff; int civil_or_wall; + bool from_string; + zend_string *date_string; bool initialized; zend_object std; }; diff --git a/ext/date/php_date.stub.php b/ext/date/php_date.stub.php index ea3aba7c7b361..5cb435647c946 100644 --- a/ext/date/php_date.stub.php +++ b/ext/date/php_date.stub.php @@ -480,6 +480,10 @@ public static function createFromDateString(string $datetime): DateInterval|fals */ public function format(string $format): string {} + public function __serialize(): array; + + public function __unserialize(array $data): void; + /** @tentative-return-type */ public function __wakeup(): void {} diff --git a/ext/date/php_date_arginfo.h b/ext/date/php_date_arginfo.h index 367674f5e4f43..722f38b1793d6 100644 --- a/ext/date/php_date_arginfo.h +++ b/ext/date/php_date_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: a157de6bca4bcf5a9ddace9e81ef700f132b4dda */ + * Stub hash: 4845891ab3872f292438de639953e2022f849125 */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_strtotime, 0, 1, MAY_BE_LONG|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, datetime, IS_STRING, 0) @@ -451,6 +451,10 @@ ZEND_END_ARG_INFO() #define arginfo_class_DateInterval_format arginfo_class_DateTimeInterface_format +#define arginfo_class_DateInterval___serialize arginfo_timezone_abbreviations_list + +#define arginfo_class_DateInterval___unserialize arginfo_class_DateTimeInterface___unserialize + #define arginfo_class_DateInterval___wakeup arginfo_class_DateTimeInterface___wakeup ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_OBJ_INFO_EX(arginfo_class_DateInterval___set_state, 0, 1, DateInterval, 0) @@ -562,6 +566,8 @@ ZEND_METHOD(DateTimeZone, __unserialize); ZEND_METHOD(DateTimeZone, __wakeup); ZEND_METHOD(DateTimeZone, __set_state); ZEND_METHOD(DateInterval, __construct); +ZEND_METHOD(DateInterval, __serialize); +ZEND_METHOD(DateInterval, __unserialize); ZEND_METHOD(DateInterval, __wakeup); ZEND_METHOD(DateInterval, __set_state); ZEND_METHOD(DatePeriod, __construct); @@ -714,6 +720,8 @@ static const zend_function_entry class_DateInterval_methods[] = { ZEND_ME(DateInterval, __construct, arginfo_class_DateInterval___construct, ZEND_ACC_PUBLIC) ZEND_ME_MAPPING(createFromDateString, date_interval_create_from_date_string, arginfo_class_DateInterval_createFromDateString, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) ZEND_ME_MAPPING(format, date_interval_format, arginfo_class_DateInterval_format, ZEND_ACC_PUBLIC) + ZEND_ME(DateInterval, __serialize, arginfo_class_DateInterval___serialize, ZEND_ACC_PUBLIC) + ZEND_ME(DateInterval, __unserialize, arginfo_class_DateInterval___unserialize, ZEND_ACC_PUBLIC) ZEND_ME(DateInterval, __wakeup, arginfo_class_DateInterval___wakeup, ZEND_ACC_PUBLIC) ZEND_ME(DateInterval, __set_state, arginfo_class_DateInterval___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) ZEND_FE_END diff --git a/ext/date/tests/DateInterval_serialize-001.phpt b/ext/date/tests/DateInterval_serialize-001.phpt new file mode 100644 index 0000000000000..cad33185cf9bb --- /dev/null +++ b/ext/date/tests/DateInterval_serialize-001.phpt @@ -0,0 +1,123 @@ +--TEST-- +Test DateInterval::__serialize and DateInterval::__unserialize +--FILE-- +__serialize()); + +echo "\n\nUsed serialised interval:\n"; +$now = new DateTimeImmutable("2022-04-22 16:25:11 BST"); +var_dump($now->add($e)); +var_dump($now->sub($e)); +?> +--EXPECTF-- +Original object: +object(DateInterval)#1 (10) { + ["y"]=> + int(2) + ["m"]=> + int(0) + ["d"]=> + int(4) + ["h"]=> + int(6) + ["i"]=> + int(8) + ["s"]=> + int(0) + ["f"]=> + float(0) + ["invert"]=> + int(0) + ["days"]=> + bool(false) + ["from_string"]=> + bool(false) +} + + +Serialised object: +string(164) "O:12:"DateInterval":10:{s:1:"y";i:2;s:1:"m";i:0;s:1:"d";i:4;s:1:"h";i:6;s:1:"i";i:8;s:1:"s";i:0;s:1:"f";d:0;s:6:"invert";i:0;s:4:"days";b:0;s:11:"from_string";b:0;}" + + +Unserialised object: +object(DateInterval)#2 (10) { + ["y"]=> + int(2) + ["m"]=> + int(0) + ["d"]=> + int(4) + ["h"]=> + int(6) + ["i"]=> + int(8) + ["s"]=> + int(0) + ["f"]=> + float(0) + ["invert"]=> + int(0) + ["days"]=> + bool(false) + ["from_string"]=> + bool(false) +} + + +Calling __serialize manually: +array(%d) { + ["y"]=> + int(2) + ["m"]=> + int(0) + ["d"]=> + int(4) + ["h"]=> + int(6) + ["i"]=> + int(8) + ["s"]=> + int(0) + ["f"]=> + float(0) + ["invert"]=> + int(0) + ["days"]=> + bool(false) + ["from_string"]=> + bool(false) +} + + +Used serialised interval: +object(DateTimeImmutable)#4 (3) { + ["date"]=> + string(26) "2024-04-26 22:33:11.000000" + ["timezone_type"]=> + int(2) + ["timezone"]=> + string(3) "BST" +} +object(DateTimeImmutable)#4 (3) { + ["date"]=> + string(26) "2020-04-18 10:17:11.000000" + ["timezone_type"]=> + int(2) + ["timezone"]=> + string(3) "BST" +} diff --git a/ext/date/tests/DateInterval_serialize-002.phpt b/ext/date/tests/DateInterval_serialize-002.phpt new file mode 100644 index 0000000000000..d21e02245e695 --- /dev/null +++ b/ext/date/tests/DateInterval_serialize-002.phpt @@ -0,0 +1,167 @@ +--TEST-- +Test DateInterval::__serialize and DateInterval::__unserialize +--FILE-- +diff($d2); +echo "Original object:\n"; +var_dump($d); + +echo "\n\nSerialised object:\n"; +$s = serialize($d); +var_dump($s); + +echo "\n\nUnserialised object:\n"; +$e = unserialize($s); +var_dump($e); + +echo "\n\nCalling __serialize manually:\n"; +var_dump($d->__serialize()); + +echo "\n\nCalling __unserialize manually:\n"; +$d = new DateInterval('P2Y4DT6H8M'); +$d->__unserialize( + [ + 'y' => 43, + 'm' => 3, + 'd' => 24, + 'h' => 1, + 'i' => 12, + 's' => 27, + 'f' => 0.654321, + 'days' => 15820, + ] +); +var_dump($d); + +echo "\n\nUsed serialised interval:\n"; +$now = new DateTimeImmutable("2022-04-15 10:27:27 BST"); +var_dump($now->add($e)); +var_dump($now->sub($e)); +?> +--EXPECTF-- +Original object: +object(DateInterval)#3 (10) { + ["y"]=> + int(43) + ["m"]=> + int(3) + ["d"]=> + int(24) + ["h"]=> + int(1) + ["i"]=> + int(12) + ["s"]=> + int(27) + ["f"]=> + float(0) + ["invert"]=> + int(0) + ["days"]=> + int(15820) + ["from_string"]=> + bool(false) +} + + +Serialised object: +string(172) "O:12:"DateInterval":10:{s:1:"y";i:43;s:1:"m";i:3;s:1:"d";i:24;s:1:"h";i:1;s:1:"i";i:12;s:1:"s";i:27;s:1:"f";d:0;s:6:"invert";i:0;s:4:"days";i:15820;s:11:"from_string";b:0;}" + + +Unserialised object: +object(DateInterval)#4 (10) { + ["y"]=> + int(43) + ["m"]=> + int(3) + ["d"]=> + int(24) + ["h"]=> + int(1) + ["i"]=> + int(12) + ["s"]=> + int(27) + ["f"]=> + float(0) + ["invert"]=> + int(0) + ["days"]=> + int(15820) + ["from_string"]=> + bool(false) +} + + +Calling __serialize manually: +array(%d) { + ["y"]=> + int(43) + ["m"]=> + int(3) + ["d"]=> + int(24) + ["h"]=> + int(1) + ["i"]=> + int(12) + ["s"]=> + int(27) + ["f"]=> + float(0) + ["invert"]=> + int(0) + ["days"]=> + int(15820) + ["from_string"]=> + bool(false) +} + + +Calling __unserialize manually: +object(DateInterval)#5 (10) { + ["y"]=> + int(43) + ["m"]=> + int(3) + ["d"]=> + int(24) + ["h"]=> + int(1) + ["i"]=> + int(12) + ["s"]=> + int(27) + ["f"]=> + float(0.654321) + ["invert"]=> + int(0) + ["days"]=> + int(15820) + ["from_string"]=> + bool(false) +} + + +Used serialised interval: +object(DateTimeImmutable)#6 (3) { + ["date"]=> + string(26) "2065-08-08 11:39:54.000000" + ["timezone_type"]=> + int(2) + ["timezone"]=> + string(3) "BST" +} +object(DateTimeImmutable)#6 (3) { + ["date"]=> + string(26) "1978-12-22 09:15:00.000000" + ["timezone_type"]=> + int(2) + ["timezone"]=> + string(3) "BST" +} diff --git a/ext/date/tests/DateInterval_serialize-003.phpt b/ext/date/tests/DateInterval_serialize-003.phpt new file mode 100644 index 0000000000000..e8915ee515d25 --- /dev/null +++ b/ext/date/tests/DateInterval_serialize-003.phpt @@ -0,0 +1,98 @@ +--TEST-- +Test DateInterval::__serialize and DateInterval::__unserialize +--FILE-- +__serialize()); + +echo "\n\nCalling __unserialize manually:\n"; +$d = new DateInterval('P2Y4DT6H8M'); +$d->__unserialize( + [ + 'from_string' => true, + 'date_string' => 'next weekday 15:30', + ] +); +var_dump($d); + +echo "\n\nUsed serialised interval:\n"; +$now = new DateTimeImmutable("2022-04-22 16:25:11 BST"); +var_dump($now->add($e)); +var_dump($now->sub($e)); +?> +--EXPECTF-- +Original object: +object(DateInterval)#1 (%d) { + ["from_string"]=> + bool(true) + ["date_string"]=> + string(18) "next weekday 15:30" +} + + +Serialised object: +string(92) "O:12:"DateInterval":2:{s:11:"from_string";b:1;s:11:"date_string";s:18:"next weekday 15:30";}" + + +Unserialised object: +object(DateInterval)#2 (2) { + ["from_string"]=> + bool(true) + ["date_string"]=> + string(18) "next weekday 15:30" +} + + +Calling __serialize manually: +array(2) { + ["from_string"]=> + bool(true) + ["date_string"]=> + string(18) "next weekday 15:30" +} + + +Calling __unserialize manually: +object(DateInterval)#3 (2) { + ["from_string"]=> + bool(true) + ["date_string"]=> + string(18) "next weekday 15:30" +} + + +Used serialised interval: +object(DateTimeImmutable)#4 (3) { + ["date"]=> + string(26) "2022-04-25 16:25:11.000000" + ["timezone_type"]=> + int(2) + ["timezone"]=> + string(3) "BST" +} + +Warning: DateTimeImmutable::sub(): Only non-special relative time specifications are supported for subtraction in %s on line %d +object(DateTimeImmutable)#4 (3) { + ["date"]=> + string(26) "2022-04-22 16:25:11.000000" + ["timezone_type"]=> + int(2) + ["timezone"]=> + string(3) "BST" +} diff --git a/ext/date/tests/DatePeriod_set_state.phpt b/ext/date/tests/DatePeriod_set_state.phpt index eaef2163cc8a3..de41eac50a5f9 100644 --- a/ext/date/tests/DatePeriod_set_state.phpt +++ b/ext/date/tests/DatePeriod_set_state.phpt @@ -34,7 +34,7 @@ object(DatePeriod)#%d (6) { ["end"]=> NULL ["interval"]=> - object(DateInterval)#%d (16) { + object(DateInterval)#%d (%d) { ["y"]=> int(0) ["m"]=> @@ -49,24 +49,12 @@ object(DatePeriod)#%d (6) { int(0) ["f"]=> float(0) - ["weekday"]=> - int(0) - ["weekday_behavior"]=> - int(0) - ["first_last_day_of"]=> - int(0) ["invert"]=> int(0) ["days"]=> bool(false) - ["special_type"]=> - int(0) - ["special_amount"]=> - int(0) - ["have_weekday_relative"]=> - int(0) - ["have_special_relative"]=> - int(0) + ["from_string"]=> + bool(false) } ["recurrences"]=> int(25) diff --git a/ext/date/tests/bug45682.phpt b/ext/date/tests/bug45682.phpt index 636381dcfeda0..84178aadb8447 100644 --- a/ext/date/tests/bug45682.phpt +++ b/ext/date/tests/bug45682.phpt @@ -13,7 +13,7 @@ $diff = date_diff($date, $other); var_dump($diff); ?> --EXPECTF-- -object(DateInterval)#%d (16) { +object(DateInterval)#%d (%d) { ["y"]=> int(0) ["m"]=> @@ -28,22 +28,10 @@ object(DateInterval)#%d (16) { int(0) ["f"]=> float(0) - ["weekday"]=> - int(0) - ["weekday_behavior"]=> - int(0) - ["first_last_day_of"]=> - int(0) ["invert"]=> int(0) ["days"]=> int(3) - ["special_type"]=> - int(0) - ["special_amount"]=> - int(0) - ["have_weekday_relative"]=> - int(0) - ["have_special_relative"]=> - int(0) + ["from_string"]=> + bool(false) } diff --git a/ext/date/tests/bug48678.phpt b/ext/date/tests/bug48678.phpt index 9c1cecd2df780..3934b187e7098 100644 --- a/ext/date/tests/bug48678.phpt +++ b/ext/date/tests/bug48678.phpt @@ -17,15 +17,9 @@ DateInterval Object [i] => 30 [s] => 5 [f] => 0 - [weekday] => 0 - [weekday_behavior] => 0 - [first_last_day_of] => 0 [invert] => 0 [days] => - [special_type] => 0 - [special_amount] => 0 - [have_weekday_relative] => 0 - [have_special_relative] => 0 + [from_string] => ) DateInterval Object ( @@ -36,13 +30,7 @@ DateInterval Object [i] => 30 [s] => 5 [f] => 0 - [weekday] => 0 - [weekday_behavior] => 0 - [first_last_day_of] => 0 [invert] => 0 [days] => - [special_type] => 0 - [special_amount] => 0 - [have_weekday_relative] => 0 - [have_special_relative] => 0 + [from_string] => ) diff --git a/ext/date/tests/bug49081.phpt b/ext/date/tests/bug49081.phpt index b5d17a6c264b6..6f98041e8f74d 100644 --- a/ext/date/tests/bug49081.phpt +++ b/ext/date/tests/bug49081.phpt @@ -18,13 +18,7 @@ DateInterval Object [i] => 0 [s] => 0 [f] => 0 - [weekday] => 0 - [weekday_behavior] => 0 - [first_last_day_of] => 0 [invert] => 0 [days] => 30 - [special_type] => 0 - [special_amount] => 0 - [have_weekday_relative] => 0 - [have_special_relative] => 0 + [from_string] => ) diff --git a/ext/date/tests/bug49778.phpt b/ext/date/tests/bug49778.phpt index 56ce135179222..d4e1a2c0ace03 100644 --- a/ext/date/tests/bug49778.phpt +++ b/ext/date/tests/bug49778.phpt @@ -8,7 +8,7 @@ echo $i->format("%d"), "\n"; echo $i->format("%a"), "\n"; ?> --EXPECTF-- -object(DateInterval)#%d (16) { +object(DateInterval)#%d (%d) { ["y"]=> int(0) ["m"]=> @@ -23,24 +23,12 @@ object(DateInterval)#%d (16) { int(0) ["f"]=> float(0) - ["weekday"]=> - int(0) - ["weekday_behavior"]=> - int(0) - ["first_last_day_of"]=> - int(0) ["invert"]=> int(0) ["days"]=> bool(false) - ["special_type"]=> - int(0) - ["special_amount"]=> - int(0) - ["have_weekday_relative"]=> - int(0) - ["have_special_relative"]=> - int(0) + ["from_string"]=> + bool(false) } 7 (unknown) diff --git a/ext/date/tests/bug52113.phpt b/ext/date/tests/bug52113.phpt index 84cd1b5210157..2e02195bd1d1a 100644 --- a/ext/date/tests/bug52113.phpt +++ b/ext/date/tests/bug52113.phpt @@ -33,7 +33,7 @@ var_dump($unser, $p); ?> --EXPECTF-- -object(DateInterval)#%d (16) { +object(DateInterval)#%d (%d) { ["y"]=> int(0) ["m"]=> @@ -48,26 +48,14 @@ object(DateInterval)#%d (16) { int(0) ["f"]=> float(0) - ["weekday"]=> - int(0) - ["weekday_behavior"]=> - int(0) - ["first_last_day_of"]=> - int(0) ["invert"]=> int(0) ["days"]=> int(0) - ["special_type"]=> - int(0) - ["special_amount"]=> - int(0) - ["have_weekday_relative"]=> - int(0) - ["have_special_relative"]=> - int(0) + ["from_string"]=> + bool(false) } -string(332) "O:12:"DateInterval":16:{s:1:"y";i:0;s:1:"m";i:0;s:1:"d";i:0;s:1:"h";i:4;s:1:"i";i:0;s:1:"s";i:0;s:1:"f";d:0;s:7:"weekday";i:0;s:16:"weekday_behavior";i:0;s:17:"first_last_day_of";i:0;s:6:"invert";i:0;s:4:"days";i:0;s:12:"special_type";i:0;s:14:"special_amount";i:0;s:21:"have_weekday_relative";i:0;s:21:"have_special_relative";i:0;}" +string(164) "O:12:"DateInterval":10:{s:1:"y";i:0;s:1:"m";i:0;s:1:"d";i:0;s:1:"h";i:4;s:1:"i";i:0;s:1:"s";i:0;s:1:"f";d:0;s:6:"invert";i:0;s:4:"days";i:0;s:11:"from_string";b:0;}" \DateInterval::__set_state(array( 'y' => 0, 'm' => 0, @@ -76,16 +64,10 @@ string(332) "O:12:"DateInterval":16:{s:1:"y";i:0;s:1:"m";i:0;s:1:"d";i:0;s:1:"h" 'i' => 0, 's' => 0, 'f' => 0.0, - 'weekday' => 0, - 'weekday_behavior' => 0, - 'first_last_day_of' => 0, 'invert' => 0, 'days' => 0, - 'special_type' => 0, - 'special_amount' => 0, - 'have_weekday_relative' => 0, - 'have_special_relative' => 0, -))object(DateInterval)#%d (16) { + 'from_string' => false, +))object(DateInterval)#%d (%d) { ["y"]=> int(0) ["m"]=> @@ -100,24 +82,12 @@ string(332) "O:12:"DateInterval":16:{s:1:"y";i:0;s:1:"m";i:0;s:1:"d";i:0;s:1:"h" int(0) ["f"]=> float(0) - ["weekday"]=> - int(0) - ["weekday_behavior"]=> - int(0) - ["first_last_day_of"]=> - int(0) ["invert"]=> int(0) ["days"]=> int(0) - ["special_type"]=> - int(0) - ["special_amount"]=> - int(0) - ["have_weekday_relative"]=> - int(0) - ["have_special_relative"]=> - int(0) + ["from_string"]=> + bool(false) } object(DatePeriod)#%d (6) { ["start"]=> @@ -134,7 +104,7 @@ object(DatePeriod)#%d (6) { ["end"]=> NULL ["interval"]=> - object(DateInterval)#%d (16) { + object(DateInterval)#%d (%d) { ["y"]=> int(0) ["m"]=> @@ -149,31 +119,19 @@ object(DatePeriod)#%d (6) { int(0) ["f"]=> float(0) - ["weekday"]=> - int(0) - ["weekday_behavior"]=> - int(0) - ["first_last_day_of"]=> - int(0) ["invert"]=> int(0) ["days"]=> int(0) - ["special_type"]=> - int(0) - ["special_amount"]=> - int(0) - ["have_weekday_relative"]=> - int(0) - ["have_special_relative"]=> - int(0) + ["from_string"]=> + bool(false) } ["recurrences"]=> int(3) ["include_start_date"]=> bool(true) } -object(DateInterval)#%d (16) { +object(DateInterval)#%d (%d) { ["y"]=> int(7) ["m"]=> @@ -188,24 +146,12 @@ object(DateInterval)#%d (16) { int(2) ["f"]=> float(0.876543) - ["weekday"]=> - int(-1) - ["weekday_behavior"]=> - int(-1) - ["first_last_day_of"]=> - int(-1) ["invert"]=> int(1) ["days"]=> int(2400) - ["special_type"]=> - int(0) - ["special_amount"]=> - int(-1) - ["have_weekday_relative"]=> - int(0) - ["have_special_relative"]=> - int(0) + ["from_string"]=> + bool(false) } object(DatePeriod)#%d (6) { ["start"]=> @@ -222,7 +168,7 @@ object(DatePeriod)#%d (6) { ["end"]=> NULL ["interval"]=> - object(DateInterval)#%d (16) { + object(DateInterval)#%d (%d) { ["y"]=> int(0) ["m"]=> @@ -237,24 +183,12 @@ object(DatePeriod)#%d (6) { int(0) ["f"]=> float(0) - ["weekday"]=> - int(0) - ["weekday_behavior"]=> - int(0) - ["first_last_day_of"]=> - int(0) ["invert"]=> int(0) ["days"]=> int(0) - ["special_type"]=> - int(0) - ["special_amount"]=> - int(0) - ["have_weekday_relative"]=> - int(0) - ["have_special_relative"]=> - int(0) + ["from_string"]=> + bool(false) } ["recurrences"]=> int(3) diff --git a/ext/date/tests/bug52738.phpt b/ext/date/tests/bug52738.phpt index 4f51fc38988a4..e0f3a1ef5c84b 100644 --- a/ext/date/tests/bug52738.phpt +++ b/ext/date/tests/bug52738.phpt @@ -29,13 +29,7 @@ di Object [i] => 0 [s] => 0 [f] => 0 - [weekday] => 0 - [weekday_behavior] => 0 - [first_last_day_of] => 0 [invert] => 0 [days] => - [special_type] => 0 - [special_amount] => 0 - [have_weekday_relative] => 0 - [have_special_relative] => 0 + [from_string] => ) diff --git a/ext/date/tests/bug52808.phpt b/ext/date/tests/bug52808.phpt index c0ab817bcc84b..a059624fdd7a0 100644 --- a/ext/date/tests/bug52808.phpt +++ b/ext/date/tests/bug52808.phpt @@ -25,7 +25,7 @@ foreach($intervals as $iv) { echo "==DONE==\n"; ?> --EXPECTF-- -object(DateInterval)#%d (16) { +object(DateInterval)#%d (%d) { ["y"]=> int(1) ["m"]=> @@ -40,26 +40,14 @@ object(DateInterval)#%d (16) { int(0) ["f"]=> float(0) - ["weekday"]=> - int(0) - ["weekday_behavior"]=> - int(0) - ["first_last_day_of"]=> - int(0) ["invert"]=> int(1) ["days"]=> int(437) - ["special_type"]=> - int(0) - ["special_amount"]=> - int(0) - ["have_weekday_relative"]=> - int(0) - ["have_special_relative"]=> - int(0) + ["from_string"]=> + bool(false) } -object(DateInterval)#%d (16) { +object(DateInterval)#%d (%d) { ["y"]=> int(0) ["m"]=> @@ -74,26 +62,14 @@ object(DateInterval)#%d (16) { int(0) ["f"]=> float(0) - ["weekday"]=> - int(0) - ["weekday_behavior"]=> - int(0) - ["first_last_day_of"]=> - int(0) ["invert"]=> int(0) ["days"]=> int(294) - ["special_type"]=> - int(0) - ["special_amount"]=> - int(0) - ["have_weekday_relative"]=> - int(0) - ["have_special_relative"]=> - int(0) + ["from_string"]=> + bool(false) } -object(DateInterval)#%d (16) { +object(DateInterval)#%d (%d) { ["y"]=> int(0) ["m"]=> @@ -108,24 +84,12 @@ object(DateInterval)#%d (16) { int(0) ["f"]=> float(0) - ["weekday"]=> - int(0) - ["weekday_behavior"]=> - int(0) - ["first_last_day_of"]=> - int(0) ["invert"]=> int(0) ["days"]=> int(294) - ["special_type"]=> - int(0) - ["special_amount"]=> - int(0) - ["have_weekday_relative"]=> - int(0) - ["have_special_relative"]=> - int(0) + ["from_string"]=> + bool(false) } Failed to parse interval (2007-05-11T15:30:00Z/) Failed to parse interval (2007-05-11T15:30:00Z) diff --git a/ext/date/tests/bug53437.phpt b/ext/date/tests/bug53437.phpt index f19f073aa9430..ed885696bec11 100644 --- a/ext/date/tests/bug53437.phpt +++ b/ext/date/tests/bug53437.phpt @@ -50,7 +50,7 @@ object(DatePeriod)#%d (6) { ["end"]=> NULL ["interval"]=> - object(DateInterval)#%d (16) { + object(DateInterval)#%d (%d) { ["y"]=> int(0) ["m"]=> @@ -65,24 +65,12 @@ object(DatePeriod)#%d (6) { int(0) ["f"]=> float(0) - ["weekday"]=> - int(0) - ["weekday_behavior"]=> - int(0) - ["first_last_day_of"]=> - int(0) ["invert"]=> int(0) ["days"]=> bool(false) - ["special_type"]=> - int(0) - ["special_amount"]=> - int(0) - ["have_weekday_relative"]=> - int(0) - ["have_special_relative"]=> - int(0) + ["from_string"]=> + bool(false) } ["recurrences"]=> int(3) @@ -111,7 +99,7 @@ object(DatePeriod)#%d (6) { ["end"]=> NULL ["interval"]=> - object(DateInterval)#%d (16) { + object(DateInterval)#%d (%d) { ["y"]=> int(0) ["m"]=> @@ -126,24 +114,12 @@ object(DatePeriod)#%d (6) { int(0) ["f"]=> float(0) - ["weekday"]=> - int(0) - ["weekday_behavior"]=> - int(0) - ["first_last_day_of"]=> - int(0) ["invert"]=> int(0) ["days"]=> bool(false) - ["special_type"]=> - int(0) - ["special_amount"]=> - int(0) - ["have_weekday_relative"]=> - int(0) - ["have_special_relative"]=> - int(0) + ["from_string"]=> + bool(false) } ["recurrences"]=> int(3) diff --git a/ext/date/tests/bug53437_var2.phpt b/ext/date/tests/bug53437_var2.phpt index 7a87b38421a50..9ca6a0f6b2762 100644 --- a/ext/date/tests/bug53437_var2.phpt +++ b/ext/date/tests/bug53437_var2.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #53437 DateInterval basic serialization +Bug #53437 (DateInterval basic serialization) --FILE-- ---EXPECT-- -object(DateInterval)#1 (16) { +--EXPECTF-- +object(DateInterval)#1 (%d) { ["y"]=> int(2) ["m"]=> @@ -27,26 +27,14 @@ object(DateInterval)#1 (16) { int(0) ["f"]=> float(0) - ["weekday"]=> - int(0) - ["weekday_behavior"]=> - int(0) - ["first_last_day_of"]=> - int(0) ["invert"]=> int(0) ["days"]=> bool(false) - ["special_type"]=> - int(0) - ["special_amount"]=> - int(0) - ["have_weekday_relative"]=> - int(0) - ["have_special_relative"]=> - int(0) + ["from_string"]=> + bool(false) } -object(DateInterval)#2 (16) { +object(DateInterval)#2 (%d) { ["y"]=> int(2) ["m"]=> @@ -61,22 +49,10 @@ object(DateInterval)#2 (16) { int(0) ["f"]=> float(0) - ["weekday"]=> - int(0) - ["weekday_behavior"]=> - int(0) - ["first_last_day_of"]=> - int(0) ["invert"]=> int(0) ["days"]=> bool(false) - ["special_type"]=> - int(0) - ["special_amount"]=> - int(0) - ["have_weekday_relative"]=> - int(0) - ["have_special_relative"]=> - int(0) + ["from_string"]=> + bool(false) } diff --git a/ext/date/tests/bug53437_var3.phpt b/ext/date/tests/bug53437_var3.phpt index eb043398e2daa..6fd5f11f0301b 100644 --- a/ext/date/tests/bug53437_var3.phpt +++ b/ext/date/tests/bug53437_var3.phpt @@ -11,7 +11,7 @@ var_dump($di); ?> --EXPECTF-- -object(DateInterval)#%d (16) { +object(DateInterval)#%d (%d) { ["y"]=> int(2) ["m"]=> @@ -24,24 +24,12 @@ object(DateInterval)#%d (16) { int(8) ["s"]=> int(0) - ["weekday"]=> - int(10) - ["weekday_behavior"]=> - int(10) - ["first_last_day_of"]=> - int(0) + ["f"]=> + float(0) ["invert"]=> int(0) ["days"]=> int(0) - ["special_type"]=> - int(0) - ["special_amount"]=> - int(-1) - ["have_weekday_relative"]=> - int(%d) - ["have_special_relative"]=> - int(0) - ["f"]=> - float(0) + ["from_string"]=> + bool(false) } diff --git a/ext/date/tests/bug53437_var4.phpt b/ext/date/tests/bug53437_var4.phpt index b53483ab7fa2b..14823fb4ba47f 100644 --- a/ext/date/tests/bug53437_var4.phpt +++ b/ext/date/tests/bug53437_var4.phpt @@ -21,7 +21,7 @@ var_dump($df, ?> --EXPECTF-- -object(DateInterval)#%d (16) { +object(DateInterval)#%d (%d) { ["y"]=> int(0) ["m"]=> @@ -36,24 +36,12 @@ object(DateInterval)#%d (16) { int(0) ["f"]=> float(0) - ["weekday"]=> - int(0) - ["weekday_behavior"]=> - int(0) - ["first_last_day_of"]=> - int(0) ["invert"]=> int(0) ["days"]=> int(2) - ["special_type"]=> - int(0) - ["special_amount"]=> - int(0) - ["have_weekday_relative"]=> - int(0) - ["have_special_relative"]=> - int(0) + ["from_string"]=> + bool(false) } int(0) int(0) diff --git a/ext/date/tests/bug53437_var5.phpt b/ext/date/tests/bug53437_var5.phpt index 55bba9ed59d8f..eb3722f38bb36 100644 --- a/ext/date/tests/bug53437_var5.phpt +++ b/ext/date/tests/bug53437_var5.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #53437 DateInterval unserialize bad data, 64 bit +Bug #53437 (DateInterval unserialize bad data, 64 bit) --SKIPIF-- --FILE-- @@ -11,7 +11,7 @@ var_dump($di); ?> --EXPECTF-- -object(DateInterval)#%d (16) { +object(DateInterval)#%d (%d) { ["y"]=> int(2) ["m"]=> @@ -24,24 +24,12 @@ object(DateInterval)#%d (16) { int(8) ["s"]=> int(0) - ["weekday"]=> - int(10) - ["weekday_behavior"]=> - int(10) - ["first_last_day_of"]=> - int(0) + ["f"]=> + float(0) ["invert"]=> int(0) ["days"]=> int(0) - ["special_type"]=> - int(0) - ["special_amount"]=> - int(9223372036854775807) - ["have_weekday_relative"]=> - int(9) - ["have_special_relative"]=> - int(0) - ["f"]=> - float(0) + ["from_string"]=> + bool(false) } diff --git a/ext/date/tests/bug53437_var6.phpt b/ext/date/tests/bug53437_var6.phpt index f5ff22c4a4612..cb76c66d4d9d3 100644 --- a/ext/date/tests/bug53437_var6.phpt +++ b/ext/date/tests/bug53437_var6.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #53437 DateInterval unserialize bad data, 64 bit +Bug #53437 (DateInterval unserialize bad data, 64 bit) --SKIPIF-- --FILE-- @@ -11,7 +11,7 @@ var_dump($di); ?> --EXPECTF-- -object(DateInterval)#%d (16) { +object(DateInterval)#%d (%d) { ["y"]=> int(2) ["m"]=> @@ -26,22 +26,10 @@ object(DateInterval)#%d (16) { int(0) ["f"]=> float(0.123654) - ["weekday"]=> - int(10) - ["weekday_behavior"]=> - int(10) - ["first_last_day_of"]=> - int(0) ["invert"]=> int(0) ["days"]=> int(0) - ["special_type"]=> - int(0) - ["special_amount"]=> - int(9223372036854775807) - ["have_weekday_relative"]=> - int(9) - ["have_special_relative"]=> - int(0) + ["from_string"]=> + bool(false) } diff --git a/ext/date/tests/bug60774.phpt b/ext/date/tests/bug60774.phpt index 0a9c4223c37c3..2f3de6bafd141 100644 --- a/ext/date/tests/bug60774.phpt +++ b/ext/date/tests/bug60774.phpt @@ -9,38 +9,10 @@ echo $i->format("%a"), "\n"; ?> --EXPECTF-- object(DateInterval)#1 (%d) { - ["y"]=> - int(0) - ["m"]=> - int(0) - ["d"]=> - int(2) - ["h"]=> - int(0) - ["i"]=> - int(0) - ["s"]=> - int(0) - ["f"]=> - float(0) - ["weekday"]=> - int(0) - ["weekday_behavior"]=> - int(0) - ["first_last_day_of"]=> - int(0) - ["invert"]=> - int(0) - ["days"]=> - bool(false) - ["special_type"]=> - int(0) - ["special_amount"]=> - int(0) - ["have_weekday_relative"]=> - int(0) - ["have_special_relative"]=> - int(0) + ["from_string"]=> + bool(true) + ["date_string"]=> + string(6) "2 days" } 2 (unknown) diff --git a/ext/date/tests/bug66545.phpt b/ext/date/tests/bug66545.phpt index 276c6d5f67581..0d2f337570698 100644 --- a/ext/date/tests/bug66545.phpt +++ b/ext/date/tests/bug66545.phpt @@ -25,13 +25,7 @@ DateInterval Object [i] => 59 [s] => 59 [f] => 0 - [weekday] => 0 - [weekday_behavior] => 0 - [first_last_day_of] => 0 [invert] => 0 [days] => 14 - [special_type] => 0 - [special_amount] => 0 - [have_weekday_relative] => 0 - [have_special_relative] => 0 + [from_string] => ) diff --git a/ext/date/tests/bug70153.phpt b/ext/date/tests/bug70153.phpt index 5b965207fc27d..9aaa0e7d538fa 100644 --- a/ext/date/tests/bug70153.phpt +++ b/ext/date/tests/bug70153.phpt @@ -3,12 +3,29 @@ Bug #70153 (\DateInterval incorrectly unserialized) --FILE-- days, $i2->days); -var_dump($i2->special_amount, $i2->special_amount); ?> --EXPECT-- +DateInterval Object +( + [from_string] => 1 + [date_string] => +1 month +) +O:12:"DateInterval":2:{s:11:"from_string";b:1;s:11:"date_string";s:8:"+1 month";} +DateInterval Object +( + [from_string] => 1 + [date_string] => +1 month +) bool(false) bool(false) -int(0) -int(0) diff --git a/ext/date/tests/bug71700.phpt b/ext/date/tests/bug71700.phpt index 53a6f9db20992..09f6e76058c52 100644 --- a/ext/date/tests/bug71700.phpt +++ b/ext/date/tests/bug71700.phpt @@ -11,8 +11,8 @@ $diff = date_diff($date1, $date2, true); var_dump($diff); ?> ---EXPECT-- -object(DateInterval)#3 (16) { +--EXPECTF-- +object(DateInterval)#3 (%d) { ["y"]=> int(0) ["m"]=> @@ -27,22 +27,10 @@ object(DateInterval)#3 (16) { int(0) ["f"]=> float(0) - ["weekday"]=> - int(0) - ["weekday_behavior"]=> - int(0) - ["first_last_day_of"]=> - int(0) ["invert"]=> int(0) ["days"]=> int(30) - ["special_type"]=> - int(0) - ["special_amount"]=> - int(0) - ["have_weekday_relative"]=> - int(0) - ["have_special_relative"]=> - int(0) + ["from_string"]=> + bool(false) } diff --git a/ext/date/tests/bug73091.phpt b/ext/date/tests/bug73091.phpt index 918170d823fb1..440f2bbca60d2 100644 --- a/ext/date/tests/bug73091.phpt +++ b/ext/date/tests/bug73091.phpt @@ -12,9 +12,7 @@ class foo { var_dump(unserialize('O:12:"DateInterval":1:{s:4:"days";O:3:"foo":0:{}}')); ?> --EXPECTF-- -object(DateInterval)#%d (16) { - ["days"]=> - int(-1) +object(DateInterval)#%d (%d) { ["y"]=> int(-1) ["m"]=> @@ -29,20 +27,10 @@ object(DateInterval)#%d (16) { int(-1) ["f"]=> float(0) - ["weekday"]=> - int(-1) - ["weekday_behavior"]=> - int(-1) - ["first_last_day_of"]=> - int(-1) ["invert"]=> int(0) - ["special_type"]=> - int(0) - ["special_amount"]=> + ["days"]=> int(-1) - ["have_weekday_relative"]=> - int(0) - ["have_special_relative"]=> - int(0) + ["from_string"]=> + bool(false) } diff --git a/ext/date/tests/bug74274.phpt b/ext/date/tests/bug74274.phpt index e03d40cf88da7..20387419728de 100644 --- a/ext/date/tests/bug74274.phpt +++ b/ext/date/tests/bug74274.phpt @@ -18,13 +18,7 @@ DateInterval Object [i] => 0 [s] => 0 [f] => 0 - [weekday] => 0 - [weekday_behavior] => 0 - [first_last_day_of] => 0 [invert] => 0 [days] => 1 - [special_type] => 0 - [special_amount] => 0 - [have_weekday_relative] => 0 - [have_special_relative] => 0 + [from_string] => ) diff --git a/ext/date/tests/bug74524.phpt b/ext/date/tests/bug74524.phpt index f49a5340185e9..825fb0be8b301 100644 --- a/ext/date/tests/bug74524.phpt +++ b/ext/date/tests/bug74524.phpt @@ -20,13 +20,7 @@ DateInterval Object [i] => 36 [s] => 10 [f] => 0.920541 - [weekday] => 0 - [weekday_behavior] => 0 - [first_last_day_of] => 0 [invert] => 1 [days] => 227 - [special_type] => 0 - [special_amount] => 0 - [have_weekday_relative] => 0 - [have_special_relative] => 0 + [from_string] => ) diff --git a/ext/date/tests/bug77571.phpt b/ext/date/tests/bug77571.phpt index f6a5b55dab0f6..84790e0cd67b9 100644 --- a/ext/date/tests/bug77571.phpt +++ b/ext/date/tests/bug77571.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #77571 (DateTime's diff DateInterval incorrect in timezones from UTC+01:00 to UTC+12:00 +Bug #77571 (DateTime's diff DateInterval incorrect in timezones from UTC+01:00 to UTC+12:00) --FILE-- 0 [s] => 0 [f] => 0 - [weekday] => 0 - [weekday_behavior] => 0 - [first_last_day_of] => 0 [invert] => 0 [days] => 35 - [special_type] => 0 - [special_amount] => 0 - [have_weekday_relative] => 0 - [have_special_relative] => 0 + [from_string] => ) diff --git a/ext/date/tests/bug78452.phpt b/ext/date/tests/bug78452.phpt index a4b095de03abb..ba6936551168b 100644 --- a/ext/date/tests/bug78452.phpt +++ b/ext/date/tests/bug78452.phpt @@ -7,8 +7,8 @@ $date1 = new \DateTime('2019-09-24 11:47:24'); $date2 = new \DateTime('2019-08-21 12:47:24'); var_dump($date1->diff($date2)); ?> ---EXPECT-- -object(DateInterval)#3 (16) { +--EXPECTF-- +object(DateInterval)#3 (%d) { ["y"]=> int(0) ["m"]=> @@ -23,22 +23,10 @@ object(DateInterval)#3 (16) { int(0) ["f"]=> float(0) - ["weekday"]=> - int(0) - ["weekday_behavior"]=> - int(0) - ["first_last_day_of"]=> - int(0) ["invert"]=> int(1) ["days"]=> int(33) - ["special_type"]=> - int(0) - ["special_amount"]=> - int(0) - ["have_weekday_relative"]=> - int(0) - ["have_special_relative"]=> - int(0) + ["from_string"]=> + bool(false) } diff --git a/ext/date/tests/bug79015.phpt b/ext/date/tests/bug79015.phpt index 9d752dee7221e..63dac799c5403 100644 --- a/ext/date/tests/bug79015.phpt +++ b/ext/date/tests/bug79015.phpt @@ -6,7 +6,7 @@ $payload = 'O:12:"DateInterval":16:{s:1:"y";i:1;s:1:"m";i:0;s:1:"d";i:4;s:1:"h"; var_dump(unserialize($payload)); ?> --EXPECTF-- -object(DateInterval)#%d (16) { +object(DateInterval)#%d (%d) { ["y"]=> int(1) ["m"]=> @@ -21,22 +21,10 @@ object(DateInterval)#%d (16) { int(0) ["f"]=> float(%f) - ["weekday"]=> - int(0) - ["weekday_behavior"]=> - int(0) - ["first_last_day_of"]=> - int(0) ["invert"]=> int(0) ["days"]=> bool(false) - ["special_type"]=> - int(0) - ["special_amount"]=> - int(0) - ["have_weekday_relative"]=> - int(0) - ["have_special_relative"]=> - int(0) + ["from_string"]=> + bool(false) } diff --git a/ext/date/tests/date_diff1.phpt b/ext/date/tests/date_diff1.phpt index 2b73eae6a8cc3..fa2c64ddd59d4 100644 --- a/ext/date/tests/date_diff1.phpt +++ b/ext/date/tests/date_diff1.phpt @@ -28,7 +28,7 @@ object(DateTime)#2 (3) { ["timezone"]=> string(3) "EDT" } -object(DateInterval)#%d (16) { +object(DateInterval)#%d (%d) { ["y"]=> int(0) ["m"]=> @@ -36,29 +36,17 @@ object(DateInterval)#%d (16) { ["d"]=> int(2) ["h"]=> - int(16) + int(%d) ["i"]=> int(19) ["s"]=> int(40) ["f"]=> float(0) - ["weekday"]=> - int(0) - ["weekday_behavior"]=> - int(0) - ["first_last_day_of"]=> - int(0) ["invert"]=> int(0) ["days"]=> int(33) - ["special_type"]=> - int(0) - ["special_amount"]=> - int(0) - ["have_weekday_relative"]=> - int(0) - ["have_special_relative"]=> - int(0) + ["from_string"]=> + bool(false) } diff --git a/ext/date/tests/date_time_fractions.phpt b/ext/date/tests/date_time_fractions.phpt index 29f7cd0d14103..4536e0f2eb21e 100644 --- a/ext/date/tests/date_time_fractions.phpt +++ b/ext/date/tests/date_time_fractions.phpt @@ -58,7 +58,7 @@ microseconds = true 2016-10-02 00:00:00.000000 2016-10-03 12:00:00.000000 2016-10-17 12:47:18.081921 -object(DateInterval)#%d (16) { +object(DateInterval)#%d (%d) { ["y"]=> int(0) ["m"]=> @@ -73,24 +73,12 @@ object(DateInterval)#%d (16) { int(0) ["f"]=> float(0.378189) - ["weekday"]=> - int(0) - ["weekday_behavior"]=> - int(0) - ["first_last_day_of"]=> - int(0) ["invert"]=> int(0) ["days"]=> int(0) - ["special_type"]=> - int(0) - ["special_amount"]=> - int(0) - ["have_weekday_relative"]=> - int(0) - ["have_special_relative"]=> - int(0) + ["from_string"]=> + bool(false) } 2016-10-03 13:20:06.724934 2016-10-03 13:20:07.103123 diff --git a/ext/standard/tests/serialize/bug69425.phpt b/ext/standard/tests/serialize/bug69425.phpt index 906c7192fb20a..1bc79c0387c8c 100644 --- a/ext/standard/tests/serialize/bug69425.phpt +++ b/ext/standard/tests/serialize/bug69425.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #69425: Use After Free in unserialize() +Bug #69425 (Use After Free in unserialize()) --FILE-- ---EXPECT-- +--EXPECTF-- int(1) array(2) { [0]=> - object(DateInterval)#1 (16) { + object(DateInterval)#1 (%d) { ["y"]=> int(-1) ["m"]=> @@ -41,24 +41,12 @@ array(2) { int(-1) ["f"]=> float(0) - ["weekday"]=> - int(-1) - ["weekday_behavior"]=> - int(-1) - ["first_last_day_of"]=> - int(-1) ["invert"]=> int(0) ["days"]=> int(-1) - ["special_type"]=> - int(0) - ["special_amount"]=> - int(-1) - ["have_weekday_relative"]=> - int(0) - ["have_special_relative"]=> - int(0) + ["from_string"]=> + bool(false) } [1]=> int(2)