if(Z_TYPE_P(pvalue) == IS_ARRAY) {
disp_param = tmp_param = NULL;
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(pvalue), key, disp_data) {
+ if (key == NULL) continue;
disp_param = mail_newbody_parameter();
disp_param->attribute = cpystr(ZSTR_VAL(key));
convert_to_string_ex(disp_data);
if (Z_TYPE_P(pvalue) == IS_ARRAY) {
disp_param = tmp_param = NULL;
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(pvalue), key, disp_data) {
+ if (key == NULL) continue;
disp_param = mail_newbody_parameter();
disp_param->attribute = cpystr(ZSTR_VAL(key));
convert_to_string_ex(disp_data);
if (Z_TYPE_P(pvalue) == IS_ARRAY) {
disp_param = tmp_param = NULL;
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(pvalue), key, disp_data) {
+ if (key == NULL) continue;
disp_param = mail_newbody_parameter();
disp_param->attribute = cpystr(ZSTR_VAL(key));
convert_to_string_ex(disp_data);
if (Z_TYPE_P(pvalue) == IS_ARRAY) {
disp_param = tmp_param = NULL;
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(pvalue), key, disp_data) {
+ if (key == NULL) continue;
disp_param = mail_newbody_parameter();
disp_param->attribute = cpystr(ZSTR_VAL(key));
convert_to_string_ex(disp_data);
--- /dev/null
+--TEST--
+Bug #80213 (imap_mail_compose() segfaults on certain $bodies)
+--SKIPIF--
+<?php
+if (!extension_loaded('imap')) die('skip imap extension not available');
+?>
+--FILE--
+<?php
+$envelope = [];
+$body = [[
+ 'type.parameters' => ['param'],
+ 'disposition' => ['disp'],
+], [
+ 'type.parameters' => ['param'],
+ 'disposition' => ['disp'],
+]];
+imap_mail_compose($envelope, $body);
+echo "done\n";
+?>
+--EXPECT--
+done