Skip to content

Commit 9cc5fe0

Browse files
committed
main: convert error_log global to zend_string*
Allows us to convert a strcmp() call to zend_string_equals_literal() which is less confusing
1 parent df1ebd6 commit 9cc5fe0

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

main/main.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -706,8 +706,9 @@ static PHP_INI_MH(OnUpdateErrorLog)
706706
return FAILURE;
707707
}
708708
}
709-
char **p = ZEND_INI_GET_ADDR();
710-
*p = new_value && ZSTR_LEN(new_value) > 0 ? ZSTR_VAL(new_value) : NULL;
709+
710+
zend_string **p = ZEND_INI_GET_ADDR();
711+
*p = new_value && ZSTR_LEN(new_value) > 0 ? new_value : NULL;
711712
return SUCCESS;
712713
}
713714
/* }}} */
@@ -940,7 +941,7 @@ PHPAPI ZEND_COLD void php_log_err_with_severity(const char *log_message, int sys
940941
int error_log_mode;
941942

942943
#ifdef HAVE_SYSLOG_H
943-
if (!strcmp(PG(error_log), "syslog")) {
944+
if (zend_string_equals_literal(PG(error_log), "syslog")) {
944945
php_syslog(syslog_type_int, "%s", log_message);
945946
PG(in_error_log) = 0;
946947
return;
@@ -953,7 +954,7 @@ PHPAPI ZEND_COLD void php_log_err_with_severity(const char *log_message, int sys
953954
error_log_mode = PG(error_log_mode);
954955
}
955956

956-
fd = VCWD_OPEN_MODE(PG(error_log), O_CREAT | O_APPEND | O_WRONLY, error_log_mode);
957+
fd = VCWD_OPEN_MODE(ZSTR_VAL(PG(error_log)), O_CREAT | O_APPEND | O_WRONLY, error_log_mode);
957958
if (fd != -1) {
958959
char *tmp;
959960
size_t len;

main/php_globals.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ struct _php_core_globals {
7474
zend_long max_memory_limit;
7575
zend_long max_input_time;
7676

77-
char *error_log;
77+
zend_string *error_log;
7878

7979
zend_string *doc_root;
8080
char *user_dir;

0 commit comments

Comments
 (0)