-
Notifications
You must be signed in to change notification settings - Fork 7.8k
HASH_FLAG_ALLOW_COW_VIOLATION
is not preserved by zend_hash_real_init_(mixed|packed)_ex()
#12986
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
Comments
Hello, It seems to me that your code is wrong. zval *value;
ZVAL_LONG(value, 1); consider : zval value;
ZVAL_LONG(&value, 1); Can you check on your side? |
@SVGAnimate Yes, of course, thanks for fixing the typo. That is not the meat of the issue however. 😉 |
What's your use-case?
|
@iluuu1994 I recently encountered the very same issue while writing code, where I had to ensure the flag exists before every single insertion in order to ensure that my RC=2 array retains the flag, e.g. DataDog/dd-trace-php@b5d3b66 (probably could have called zend_hash_real_init manually too, but anyway...) The use case in that code is having control over the destruction (zval_ptr_dtor will fail hard when called on a persistent array - but that's a separate issue). This was quite ugly, so I'm totally agreeing with improving this here. |
I'm closing the issue as WONTFIX. |
Description
Hi,
Currently the zend_hash_real_init_mixed_ex and zend_hash_real_init_packed_ex functions overwrite the hashtable flags which causes the following example to fail:
Would you consider a PR that preserves this flag through the initialization process ?
Thanks.
PHP Version
PHP 8.3-dev
Operating System
irrelevant
The text was updated successfully, but these errors were encountered: