[php-src] master: soap: only do a single call to zend_hash_get_current_key() (#25294)
| From: | Gina Peter Banyard via GitHub | Date: | Sun, 08 Nov 2026 03:09:49 +0000 |
| Subject: | [php-src] master: soap: only do a single call to zend_hash_get_current_key() (#25294) | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-143412@lists.php.net to get a copy of this message | ||
Author: Gina Peter Banyard (Girgias)
Committer: GitHub (web-flow)
Pusher: Girgias
Date: 2026-11-08T03:09:45Z
Commit: https://github.com/php/php-src/commit/5859090b2ae400534a1ad21ad5b3fcb855c152be
Raw diff: https://github.com/php/php-src/commit/5859090b2ae400534a1ad21ad5b3fcb855c152be.diff
soap: only do a single call to zend_hash_get_current_key() (#25294)
No need to repeat the work by first calling zend_hash_get_current_key_type() and then
zend_hash_get_current_key() depending on the type.
Changed paths:
M ext/soap/php_schema.c
Diff:
diff --git a/ext/soap/php_schema.c b/ext/soap/php_schema.c
index 195c5abe45eb..d331296eede3 100644
--- a/ext/soap/php_schema.c
+++ b/ext/soap/php_schema.c
@@ -2200,8 +2200,10 @@ static void schema_attributegroup_fixup(sdlCtx *ctx, sdlAttributePtr attr,
HashT
if (tmp->attributes) {
zend_hash_internal_pointer_reset(tmp->attributes);
while ((tmp_attr = zend_hash_get_current_data_ptr(tmp->attributes)) != NULL) {
- if (zend_hash_get_current_key_type(tmp->attributes) == HASH_KEY_IS_STRING) {
- zend_string* _key;
+ zend_string *key;
+ zend_ulong index;
+ zend_hash_key_type status = zend_hash_get_current_key(tmp->attributes, &key,
&index);
+ if (status == HASH_KEY_IS_STRING) {
sdlAttributePtr newAttr;
schema_attribute_fixup(ctx, tmp_attr);
@@ -2219,15 +2221,12 @@ static void schema_attributegroup_fixup(sdlCtx *ctx, sdlAttributePtr attr,
HashT
newAttr->extraAttributes = ht;
}
- zend_hash_get_current_key(tmp->attributes, &_key, NULL);
- zend_hash_add_ptr(ht, _key, newAttr);
+ zend_hash_add_ptr(ht, key, newAttr);
zend_hash_move_forward(tmp->attributes);
} else {
- zend_ulong index;
-
+ ZEND_ASSERT(status == HASH_KEY_IS_LONG);
schema_attributegroup_fixup(ctx, tmp_attr, ht);
- zend_hash_get_current_key(tmp->attributes, NULL, &index);
zend_hash_index_del(tmp->attributes, index);
}
}