Skip to content

Commit a27f772

Browse files
committed
Remove redundant HASH_OF in mail.c
And use ZEND_HASH_FOREACH_STR_KEY_VAL where the integer key is not needed.
1 parent 4ca5b35 commit a27f772

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

ext/standard/mail.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,10 @@ static void php_mail_build_headers_elem(smart_str *s, zend_string *key, zval *va
162162

163163
static void php_mail_build_headers_elems(smart_str *s, zend_string *key, zval *val)
164164
{
165-
zend_ulong idx;
166165
zend_string *tmp_key;
167166
zval *tmp_val;
168167

169-
(void)(idx);
170-
ZEND_HASH_FOREACH_KEY_VAL(HASH_OF(val), idx, tmp_key, tmp_val) {
168+
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(val), tmp_key, tmp_val) {
171169
if (tmp_key) {
172170
php_error_docref(NULL, E_WARNING, "Multiple header key must be numeric index (%s)", ZSTR_VAL(tmp_key));
173171
continue;
@@ -190,7 +188,7 @@ PHPAPI zend_string *php_mail_build_headers(zval *headers)
190188

191189
ZEND_ASSERT(Z_TYPE_P(headers) == IS_ARRAY);
192190

193-
ZEND_HASH_FOREACH_KEY_VAL(HASH_OF(headers), idx, key, val) {
191+
ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(headers), idx, key, val) {
194192
if (!key) {
195193
php_error_docref(NULL, E_WARNING, "Found numeric header (" ZEND_LONG_FMT ")", idx);
196194
continue;

0 commit comments

Comments
 (0)