Commit 9362fc793cc for php.net
commit 9362fc793cc17ff01efddbfbb2bb2b716daad0fc
Author: Gina Peter Banyard <girgias@php.net>
Date: Sun Jul 19 18:29:28 2026 +0100
main: convert error_log global to zend_string*
Allows us to convert a strcmp() call to zend_string_equals_literal() which is less confusing
diff --git a/main/main.c b/main/main.c
index 5d26de4edc5..7c5f8baae30 100644
--- a/main/main.c
+++ b/main/main.c
@@ -706,8 +706,9 @@ static PHP_INI_MH(OnUpdateErrorLog)
return FAILURE;
}
}
- char **p = ZEND_INI_GET_ADDR();
- *p = new_value && ZSTR_LEN(new_value) > 0 ? ZSTR_VAL(new_value) : NULL;
+
+ zend_string **p = ZEND_INI_GET_ADDR();
+ *p = new_value && ZSTR_LEN(new_value) > 0 ? new_value : NULL;
return SUCCESS;
}
/* }}} */
@@ -940,7 +941,7 @@ PHPAPI ZEND_COLD void php_log_err_with_severity(const char *log_message, int sys
int error_log_mode;
#ifdef HAVE_SYSLOG_H
- if (!strcmp(PG(error_log), "syslog")) {
+ if (zend_string_equals_literal(PG(error_log), "syslog")) {
php_syslog(syslog_type_int, "%s", log_message);
PG(in_error_log) = 0;
return;
@@ -953,7 +954,7 @@ PHPAPI ZEND_COLD void php_log_err_with_severity(const char *log_message, int sys
error_log_mode = PG(error_log_mode);
}
- fd = VCWD_OPEN_MODE(PG(error_log), O_CREAT | O_APPEND | O_WRONLY, error_log_mode);
+ fd = VCWD_OPEN_MODE(ZSTR_VAL(PG(error_log)), O_CREAT | O_APPEND | O_WRONLY, error_log_mode);
if (fd != -1) {
char *tmp;
size_t len;
diff --git a/main/php_globals.h b/main/php_globals.h
index 74639ffe0d4..45a1b0e44bf 100644
--- a/main/php_globals.h
+++ b/main/php_globals.h
@@ -74,7 +74,7 @@ struct _php_core_globals {
zend_long max_memory_limit;
zend_long max_input_time;
- char *error_log;
+ zend_string *error_log;
zend_string *doc_root;
char *user_dir;