[php-src] Issue #15595: Please add `zend_symtable_str_add` function
| From: | matyhtf | Date: | Tue, 27 Aug 2024 05:10:58 +0000 |
| Subject: | [php-src] Issue #15595: Please add `zend_symtable_str_add` function | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-247603@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/15595
Author: matyhtf
### Description
The absence of this API requires a self-implemented solution, which should be provided by
Zend_API.h.
```c
static zend_always_inline zval *zend_symtable_str_add(HashTable *ht, const char *str, size_t len,
zval *pData) {
zend_ulong idx;
if (ZEND_HANDLE_NUMERIC_STR(str, len, idx)) {
return zend_hash_index_add(ht, idx, pData);
} else {
return zend_hash_str_add(ht, str, len, pData);
}
}
```