-
Notifications
You must be signed in to change notification settings - Fork 8k
Fix #70153 \DateInterval incorrectly unserialized #4687
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
adae5c1
ab9f351
0cd51d6
3f378ea
e850ba4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4357,7 +4357,11 @@ static int php_date_interval_initialize_from_hash(zval **return_value, php_inter | |
| zval *z_arg = zend_hash_str_find(myht, element, sizeof(element) - 1); \ | ||
| if (z_arg && Z_TYPE_P(z_arg) <= IS_STRING) { \ | ||
| zend_string *str = zval_get_string(z_arg); \ | ||
| DATE_A64I((*intobj)->diff->member, ZSTR_VAL(str)); \ | ||
| if (str->len) { \ | ||
| DATE_A64I((*intobj)->diff->member, ZSTR_VAL(str)); \ | ||
| } else { \ | ||
| (*intobj)->diff->member = -99999; \ | ||
| } \ | ||
|
||
| zend_string_release(str); \ | ||
| } else { \ | ||
| (*intobj)->diff->member = -1LL; \ | ||
|
|
@@ -4661,7 +4665,7 @@ PHP_METHOD(DatePeriod, __construct) | |
| dpobj->end = clone; | ||
| } | ||
| } | ||
|
|
||
| if (dpobj->end == NULL && recurrences < 1) { | ||
| php_error_docref(NULL, E_WARNING, "The recurrence count '%d' is invalid. Needs to be > 0", (int) recurrences); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| --TEST-- | ||
| Bug #70153 (\DateInterval incorrectly unserialized) | ||
| --FILE-- | ||
| <?php | ||
| $i1 = \DateInterval::createFromDateString('+1 month'); | ||
| $i2 = unserialize(serialize($i1)); | ||
| var_dump($i1->days, $i2->days); | ||
| var_dump($i2->special_amount, $i2->special_amount); | ||
| ?> | ||
| --EXPECT-- | ||
| bool(false) | ||
| bool(false) | ||
| int(0) | ||
| int(0) |
Uh oh!
There was an error while loading. Please reload this page.