1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

ext/standard/mail: use zend_string* for extra_cmd param of php_mail()

This commit is contained in:
Gina Peter Banyard
2025-12-24 18:08:32 +01:00
parent 5f8c7dc87c
commit c727f4d6c5
4 changed files with 6 additions and 5 deletions

View File

@@ -74,6 +74,7 @@ PHP 8.6 INTERNALS UPGRADE NOTES
. _php_error_log() now has a formal return type of zend_result.
. _php_error_log() now accepts zend_string* values instead of char*.
. _php_error_log_ex() has been removed.
. php_mail()'s extra_cmd parameter is now a zend_string*.
========================
4. OpCode changes

View File

@@ -4703,7 +4703,7 @@ PHP_FUNCTION(mb_send_mail)
extra_cmd = php_escape_shell_cmd(extra_cmd);
}
RETVAL_BOOL(php_mail(to_r, ZSTR_VAL(subject), message, ZSTR_VAL(str_headers), extra_cmd ? ZSTR_VAL(extra_cmd) : NULL));
RETVAL_BOOL(php_mail(to_r, ZSTR_VAL(subject), message, ZSTR_VAL(str_headers), extra_cmd));
if (extra_cmd) {
zend_string_release_ex(extra_cmd, 0);

View File

@@ -343,7 +343,7 @@ PHP_FUNCTION(mail)
extra_cmd = php_escape_shell_cmd(extra_cmd);
}
if (php_mail(to_r, subject_r, message, headers_str && ZSTR_LEN(headers_str) ? ZSTR_VAL(headers_str) : NULL, extra_cmd ? ZSTR_VAL(extra_cmd) : NULL)) {
if (php_mail(to_r, subject_r, message, headers_str && ZSTR_LEN(headers_str) ? ZSTR_VAL(headers_str) : NULL, extra_cmd)) {
RETVAL_TRUE;
} else {
RETVAL_FALSE;
@@ -434,7 +434,7 @@ static int php_mail_detect_multiple_crlf(const char *hdr) {
/* {{{ php_mail */
PHPAPI bool php_mail(const char *to, const char *subject, const char *message, const char *headers, const char *extra_cmd)
PHPAPI bool php_mail(const char *to, const char *subject, const char *message, const char *headers, const zend_string *extra_cmd)
{
FILE *sendmail;
char *sendmail_path = INI_STR("sendmail_path");
@@ -551,7 +551,7 @@ PHPAPI bool php_mail(const char *to, const char *subject, const char *message, c
#endif
}
if (extra_cmd != NULL) {
spprintf(&sendmail_cmd, 0, "%s %s", sendmail_path, extra_cmd);
spprintf(&sendmail_cmd, 0, "%s %s", sendmail_path, ZSTR_VAL(extra_cmd));
} else {
sendmail_cmd = sendmail_path;
}

View File

@@ -20,6 +20,6 @@
PHP_MINFO_FUNCTION(mail);
PHPAPI zend_string *php_mail_build_headers(const HashTable *headers);
PHPAPI extern bool php_mail(const char *to, const char *subject, const char *message, const char *headers, const char *extra_cmd);
PHPAPI extern bool php_mail(const char *to, const char *subject, const char *message, const char *headers, const zend_string *extra_cmd);
#endif /* PHP_MAIL_H */