Skip to content

Fix GH-16053: array_merge_recursive(): convert_to_array() may need separation #16061

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

Merged
merged 1 commit into from
Oct 2, 2024

Conversation

arnaud-lb
Copy link
Member

@arnaud-lb arnaud-lb commented Sep 25, 2024

Fixes GH-16053

@arnaud-lb arnaud-lb changed the title Fix array_merge_recursive(): convert_to_array() may need separation Fix GH-16053: array_merge_recursive(): convert_to_array() may need separation Sep 25, 2024
@arnaud-lb arnaud-lb changed the base branch from master to PHP-8.2 September 25, 2024 17:37
zend_throw_error(NULL, "Recursion detected");
return 0;
}

ZEND_ASSERT(!Z_ISREF_P(dest_entry) || Z_REFCOUNT_P(dest_entry) > 1);
SEPARATE_ZVAL(dest_entry);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove this one (move it after convert_to_array) because convert_to_array will change dest_entry itself, not its value.

This function needs some cleanup, as there are leftovers from previous refactorings. For instance I believe that src_entry == dest_entry above is always false, and we don't use the result of ZVAL_DEREF(dest_zval) because of dest_zval = dest_entry below. However this is out of scope of this bug fix.

@arnaud-lb arnaud-lb marked this pull request as ready for review September 25, 2024 19:20
@arnaud-lb arnaud-lb requested a review from bukka as a code owner September 25, 2024 19:20
@arnaud-lb arnaud-lb merged commit 545bef8 into php:PHP-8.2 Oct 2, 2024
8 checks passed
arnaud-lb added a commit that referenced this pull request Oct 2, 2024
arnaud-lb added a commit that referenced this pull request Oct 2, 2024
* PHP-8.2:
  [ci skip] NEWS for GH-16061
arnaud-lb added a commit that referenced this pull request Oct 2, 2024
arnaud-lb added a commit that referenced this pull request Oct 2, 2024
* PHP-8.3:
  [ci skip] NEWS for GH-16061
  [ci skip] NEWS for GH-16061
arnaud-lb added a commit that referenced this pull request Oct 2, 2024
arnaud-lb added a commit that referenced this pull request Oct 2, 2024
* PHP-8.4:
  [ci skip] NEWS for GH-16061
  [ci skip] NEWS for GH-16061
  [ci skip] NEWS for GH-16061
arnaud-lb added a commit that referenced this pull request Oct 2, 2024
arnaud-lb added a commit that referenced this pull request Oct 2, 2024
* PHP-8.2:
  [ci skip] NEWS for GH-16061
  Fix array_merge_recursive(): convert_to_array() may need separation (#16061)
arnaud-lb added a commit that referenced this pull request Oct 2, 2024
* PHP-8.3:
  [ci skip] NEWS for GH-16061
  Fix array_merge_recursive(): convert_to_array() may need separation (#16061)
arnaud-lb added a commit that referenced this pull request Oct 2, 2024
* PHP-8.4:
  [ci skip] NEWS for GH-16061
  Fix array_merge_recursive(): convert_to_array() may need separation (#16061)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Assertion failure in Zend/zend_hash.c
2 participants