Skip to content

ext/standard: Use *_add instead of *_update for new keys in array_count_values#21530

Open
arshidkv12 wants to merge 1 commit intophp:masterfrom
arshidkv12:hash-1
Open

ext/standard: Use *_add instead of *_update for new keys in array_count_values#21530
arshidkv12 wants to merge 1 commit intophp:masterfrom
arshidkv12:hash-1

Conversation

@arshidkv12
Copy link
Contributor

No description provided.

@arshidkv12 arshidkv12 requested a review from bukka as a code owner March 25, 2026 17:01
@arshidkv12 arshidkv12 changed the title Use *_add instead of *_update for new keys in array_count_values ext/standard: Use *_add instead of *_update for new keys in array_count_values Mar 25, 2026
@devnexen
Copy link
Member

@arshidkv12 ... can you explain what your changes bring please ?

zval data;
ZVAL_LONG(&data, 1);
zend_hash_index_update(Z_ARRVAL_P(return_value), Z_LVAL_P(entry), &data);
zend_hash_index_add(Z_ARRVAL_P(return_value), Z_LVAL_P(entry), &data);
Copy link
Member

@iluuu1994 iluuu1994 Mar 25, 2026

Choose a reason for hiding this comment

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

If the intent is to generate better assembly, should be zend_hash_index_add_new() then I suppose?

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.

3 participants