Fix leak on double DatePeriod::__construct() call#22643
Open
iluuu1994 wants to merge 1 commit into
Open
Conversation
TimWolla
approved these changes
Jul 8, 2026
TimWolla
left a comment
Member
There was a problem hiding this comment.
Just looked at the diff, didn't check for completeness. I trust you there.
| if (period_obj->interval) { | ||
| timelib_rel_time_dtor(period_obj->interval); | ||
| } | ||
| memset(period_obj, 0, XtOffsetOf(php_period_obj, std)); |
Member
There was a problem hiding this comment.
Suggested change
| memset(period_obj, 0, XtOffsetOf(php_period_obj, std)); | |
| memset(period_obj, 0, offsetof(php_period_obj, std)); |
We only removed XtOffsetOf with 8.6, but offsetof() is reliably available even for 8.4.
Member
Author
There was a problem hiding this comment.
I remembered your change. Will have to be backported to 8.2, so I'd prefer just changing on master to match your other PR.
Member
Author
|
@kylekatarnls I hope it's ok to ping you directly. Just wanted to check with you whether the double constructor call is even intentional. This issue popped up recently in our CI, so I figured it might not be. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See https://github.com/php/php-src/actions/runs/28911263674/job/85769105449.
Normally we might want to discuss whether such code is even sensible, but it seems carbon is relying on it, as evidenced by the CI failure above. A minimal carbon example that reproduces the error:
Just remembered, will have to rebase onto 8.2 to keep nightly green.