mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Fixed attempt to modify immutable array
This commit is contained in:
parent
549c5a5c1b
commit
31faac3250
1 changed files with 102 additions and 98 deletions
|
@ -3472,6 +3472,7 @@ PHP_FUNCTION(imap_mail_compose)
|
|||
PARAMETER *param, *disp_param = NULL, *custom_headers_param = NULL, *tmp_param = NULL;
|
||||
char *tmp=NULL, *mystring=NULL, *t=NULL, *tempstring=NULL, *str_copy = NULL;
|
||||
int toppart = 0;
|
||||
int first;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "aa", &envelope, &body) == FAILURE) {
|
||||
return;
|
||||
|
@ -3543,13 +3544,16 @@ PHP_FUNCTION(imap_mail_compose)
|
|||
}
|
||||
}
|
||||
|
||||
zend_hash_internal_pointer_reset(Z_ARRVAL_P(body));
|
||||
if ((data = zend_hash_get_current_data(Z_ARRVAL_P(body))) == NULL || Z_TYPE_P(data) != IS_ARRAY) {
|
||||
first = 1;
|
||||
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(body), data) {
|
||||
if (first) {
|
||||
first = 0;
|
||||
|
||||
if (Z_TYPE_P(data) != IS_ARRAY) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "body parameter must be a non-empty array");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (Z_TYPE_P(data) == IS_ARRAY) {
|
||||
bod = mail_newbody();
|
||||
topbod = bod;
|
||||
|
||||
|
@ -3638,11 +3642,7 @@ PHP_FUNCTION(imap_mail_compose)
|
|||
convert_to_string_ex(pvalue);
|
||||
bod->md5 = cpystr(Z_STRVAL_P(pvalue));
|
||||
}
|
||||
}
|
||||
|
||||
zend_hash_move_forward(Z_ARRVAL_P(body));
|
||||
while ((data = zend_hash_get_current_data(Z_ARRVAL_P(body))) != NULL) {
|
||||
if (Z_TYPE_P(data) == IS_ARRAY) {
|
||||
} else if (Z_TYPE_P(data) == IS_ARRAY) {
|
||||
short type = -1;
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "type", sizeof("type") - 1)) != NULL) {
|
||||
convert_to_long_ex(pvalue);
|
||||
|
@ -3747,7 +3747,11 @@ PHP_FUNCTION(imap_mail_compose)
|
|||
bod->md5 = cpystr(Z_STRVAL_P(pvalue));
|
||||
}
|
||||
}
|
||||
zend_hash_move_forward(Z_ARRVAL_P(body));
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
|
||||
if (first) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "body parameter must be a non-empty array");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (bod && bod->type == TYPEMULTIPART && (!bod->nested.part || !bod->nested.part->next)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue