mirror of
https://github.com/php/php-src.git
synced 2026-03-24 08:12:21 +01:00
Merge branch 'PHP-8.4' into PHP-8.5
This commit is contained in:
1
NEWS
1
NEWS
@@ -53,6 +53,7 @@ PHP NEWS
|
||||
|
||||
- Standard:
|
||||
. Fix error check for proc_open() command. (ndossche)
|
||||
. Fix memory leak in mail() when header key is numeric. (Girgias)
|
||||
|
||||
- URI:
|
||||
. Fixed bug GH-20771 (Assertion failure when getUnicodeHost() returns
|
||||
|
||||
@@ -218,7 +218,8 @@ PHPAPI zend_string *php_mail_build_headers(HashTable *headers)
|
||||
ZEND_HASH_FOREACH_KEY_VAL(headers, idx, key, val) {
|
||||
if (!key) {
|
||||
zend_type_error("Header name cannot be numeric, " ZEND_LONG_FMT " given", idx);
|
||||
break;
|
||||
smart_str_free(&s);
|
||||
return NULL;
|
||||
}
|
||||
ZVAL_DEREF(val);
|
||||
/* https://tools.ietf.org/html/rfc2822#section-3.6 */
|
||||
|
||||
15
ext/standard/tests/mail/gh20776.phpt
Normal file
15
ext/standard/tests/mail/gh20776.phpt
Normal file
@@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
GH-20776: mail() memory leak when header array contains numeric keys
|
||||
--FILE--
|
||||
<?php
|
||||
$to = "user@example.com";
|
||||
$subject = $message = "";
|
||||
|
||||
try {
|
||||
var_dump(mail($to, $subject, $message, ['RandomHeader' => 'Value', 5 => 'invalid key']));
|
||||
} catch (Throwable $e) {
|
||||
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
TypeError: Header name cannot be numeric, 5 given
|
||||
Reference in New Issue
Block a user