Skip to content

Commit 5597b07

Browse files
committed
ext/standard/mail.c: use zend_string for mail_log
1 parent 7a0bcc5 commit 5597b07

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

ext/standard/mail.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -392,10 +392,10 @@ static void php_mail_log_to_syslog(char *message) {
392392
}
393393

394394

395-
static void php_mail_log_to_file(const char *filename, const char *message, size_t message_size) {
395+
static void php_mail_log_to_file(const zend_string *filename, const char *message, size_t message_size) {
396396
/* Write 'message' to the given file. */
397397
uint32_t flags = REPORT_ERRORS | STREAM_DISABLE_OPEN_BASEDIR;
398-
php_stream *stream = php_stream_open_wrapper(filename, "a", flags, NULL);
398+
php_stream *stream = php_stream_open_wrapper(ZSTR_VAL(filename), "a", flags, NULL);
399399
if (stream) {
400400
php_stream_write(stream, message, message_size);
401401
php_stream_close(stream);
@@ -446,7 +446,7 @@ PHPAPI bool php_mail(const char *to, const char *subject, const char *message, c
446446
FILE *sendmail;
447447
char *sendmail_path = INI_STR("sendmail_path");
448448
char *sendmail_cmd = NULL;
449-
const char *mail_log = INI_STR("mail.log");
449+
const zend_string *mail_log = zend_ini_str(ZEND_STRL("mail.log"), false);
450450
const char *hdr = headers;
451451
char *ahdr = NULL;
452452
#if PHP_SIGCHILD
@@ -459,7 +459,7 @@ PHPAPI bool php_mail(const char *to, const char *subject, const char *message, c
459459
} \
460460
return val; \
461461

462-
if (mail_log && *mail_log) {
462+
if (mail_log && ZSTR_LEN(mail_log)) {
463463
char *logline;
464464

465465
spprintf(&logline, 0, "mail() on [%s:%d]: To: %s -- Headers: %s -- Subject: %s", zend_get_executed_filename(), zend_get_executed_lineno(), to, hdr ? hdr : "", subject);
@@ -468,7 +468,7 @@ PHPAPI bool php_mail(const char *to, const char *subject, const char *message, c
468468
php_mail_log_crlf_to_spaces(logline);
469469
}
470470

471-
if (!strcmp(mail_log, "syslog")) {
471+
if (zend_string_equals_literal(mail_log, "syslog")) {
472472
php_mail_log_to_syslog(logline);
473473
} else {
474474
/* Add date when logging to file */

0 commit comments

Comments
 (0)