Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 12 additions & 17 deletions ext/date/php_date.c
Original file line number Diff line number Diff line change
Expand Up @@ -3051,8 +3051,9 @@ PHP_METHOD(DateTimeImmutable, __unserialize)
}
/* }}} */

/* {{{ */
PHP_METHOD(DateTime, __wakeup)
/* {{{
* Common implementation for DateTime::__wakeup() and DateTimeImmutable::__wakeup() */
static void php_do_date_time_wakeup(INTERNAL_FUNCTION_PARAMETERS, const char *class_name)
{
zval *object = ZEND_THIS;
php_date_obj *dateobj;
Expand All @@ -3065,29 +3066,23 @@ PHP_METHOD(DateTime, __wakeup)
myht = Z_OBJPROP_P(object);

if (!php_date_initialize_from_hash(&dateobj, myht)) {
zend_throw_error(NULL, "Invalid serialization data for DateTime object");
zend_throw_error(NULL, "Invalid serialization data for %s object", class_name);
RETURN_THROWS();
}
}
/* }}} */

/* {{{ */
PHP_METHOD(DateTimeImmutable, __wakeup)
PHP_METHOD(DateTime, __wakeup)
{
zval *object = ZEND_THIS;
php_date_obj *dateobj;
HashTable *myht;

ZEND_PARSE_PARAMETERS_NONE();

dateobj = Z_PHPDATE_P(object);

myht = Z_OBJPROP_P(object);
php_do_date_time_wakeup(INTERNAL_FUNCTION_PARAM_PASSTHRU, "DateTime");
}
/* }}} */

if (!php_date_initialize_from_hash(&dateobj, myht)) {
zend_throw_error(NULL, "Invalid serialization data for DateTimeImmutable object");
RETURN_THROWS();
}
/* {{{ */
PHP_METHOD(DateTimeImmutable, __wakeup)
{
php_do_date_time_wakeup(INTERNAL_FUNCTION_PARAM_PASSTHRU, "DateTimeImmutable");
}
/* }}} */

Expand Down
Loading