[php-src] master: main: convert error_log global to zend_string*

From: Date: Thu, 30 Jul 2026 08:46:15 +0000
Subject: [php-src] master: main: convert error_log global to zend_string*
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-140330@lists.php.net to get a copy of this message
Author: Gina Peter Banyard (Girgias) Date: 2026-07-30T09:45:57+01:00 Commit: https://github.com/php/php-src/commit/9362fc793cc17ff01efddbfbb2bb2b716daad0fc Raw diff: https://github.com/php/php-src/commit/9362fc793cc17ff01efddbfbb2bb2b716daad0fc.diff main: convert error_log global to zend_string* Allows us to convert a strcmp() call to zend_string_equals_literal() which is less confusing Changed paths: M main/main.c M main/php_globals.h Diff: diff --git a/main/main.c b/main/main.c index 5d26de4edc5e..7c5f8baae304 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 74639ffe0d47..45a1b0e44bf5 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;

« previous php.cvs (#140330) next »