Skip to content

Commit c727f4d

Browse files
committed
ext/standard/mail: use zend_string* for extra_cmd param of php_mail()
1 parent 5f8c7dc commit c727f4d

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

UPGRADING.INTERNALS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ PHP 8.6 INTERNALS UPGRADE NOTES
7474
. _php_error_log() now has a formal return type of zend_result.
7575
. _php_error_log() now accepts zend_string* values instead of char*.
7676
. _php_error_log_ex() has been removed.
77+
. php_mail()'s extra_cmd parameter is now a zend_string*.
7778

7879
========================
7980
4. OpCode changes

ext/mbstring/mbstring.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4703,7 +4703,7 @@ PHP_FUNCTION(mb_send_mail)
47034703
extra_cmd = php_escape_shell_cmd(extra_cmd);
47044704
}
47054705

4706-
RETVAL_BOOL(php_mail(to_r, ZSTR_VAL(subject), message, ZSTR_VAL(str_headers), extra_cmd ? ZSTR_VAL(extra_cmd) : NULL));
4706+
RETVAL_BOOL(php_mail(to_r, ZSTR_VAL(subject), message, ZSTR_VAL(str_headers), extra_cmd));
47074707

47084708
if (extra_cmd) {
47094709
zend_string_release_ex(extra_cmd, 0);

ext/standard/mail.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ PHP_FUNCTION(mail)
343343
extra_cmd = php_escape_shell_cmd(extra_cmd);
344344
}
345345

346-
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)) {
346+
if (php_mail(to_r, subject_r, message, headers_str && ZSTR_LEN(headers_str) ? ZSTR_VAL(headers_str) : NULL, extra_cmd)) {
347347
RETVAL_TRUE;
348348
} else {
349349
RETVAL_FALSE;
@@ -434,7 +434,7 @@ static int php_mail_detect_multiple_crlf(const char *hdr) {
434434

435435

436436
/* {{{ php_mail */
437-
PHPAPI bool php_mail(const char *to, const char *subject, const char *message, const char *headers, const char *extra_cmd)
437+
PHPAPI bool php_mail(const char *to, const char *subject, const char *message, const char *headers, const zend_string *extra_cmd)
438438
{
439439
FILE *sendmail;
440440
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
551551
#endif
552552
}
553553
if (extra_cmd != NULL) {
554-
spprintf(&sendmail_cmd, 0, "%s %s", sendmail_path, extra_cmd);
554+
spprintf(&sendmail_cmd, 0, "%s %s", sendmail_path, ZSTR_VAL(extra_cmd));
555555
} else {
556556
sendmail_cmd = sendmail_path;
557557
}

ext/standard/php_mail.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@
2020
PHP_MINFO_FUNCTION(mail);
2121

2222
PHPAPI zend_string *php_mail_build_headers(const HashTable *headers);
23-
PHPAPI extern bool php_mail(const char *to, const char *subject, const char *message, const char *headers, const char *extra_cmd);
23+
PHPAPI extern bool php_mail(const char *to, const char *subject, const char *message, const char *headers, const zend_string *extra_cmd);
2424

2525
#endif /* PHP_MAIL_H */

0 commit comments

Comments
 (0)