[php-src] PHP-8.4: Fix GHSA-gr4f-wgx5-jpfv: DATEG(tzcache) use-after-free

From: Date: Thu, 19 Nov 2026 15:26:26 +0000
Subject: [php-src] PHP-8.4: Fix GHSA-gr4f-wgx5-jpfv: DATEG(tzcache) use-after-free
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-143909@lists.php.net to get a copy of this message
Author: Ilija Tovilo (iluuu1994) Committer: Jakub Zelenka (bukka) Date: 2026-11-19T16:08:08+01:00 Commit: https://github.com/php/php-src/commit/cb20015e045508ed6642ab7d72858270f9224d64 Raw diff: https://github.com/php/php-src/commit/cb20015e045508ed6642ab7d72858270f9224d64.diff Fix GHSA-gr4f-wgx5-jpfv: DATEG(tzcache) use-after-free Changed paths: A ext/date/tests/GHSA-gr4f-wgx5-jpfv.phpt M ext/zend_test/php_test.h M ext/zend_test/test.c M main/main.c Diff: diff --git a/ext/date/tests/GHSA-gr4f-wgx5-jpfv.phpt b/ext/date/tests/GHSA-gr4f-wgx5-jpfv.phpt new file mode 100644 index 000000000000..bb81c93ddb27 --- /dev/null +++ b/ext/date/tests/GHSA-gr4f-wgx5-jpfv.phpt @@ -0,0 +1,22 @@ +--TEST-- +GHSA-gr4f-wgx5-jpfv: DATEG(tzcache) use-after-free +--CREDITS-- +Sebastian Bergmann +--CGI-- +--ENV-- +QUERY_STRING=a=1&b=2 +--EXTENSIONS-- +session +zend_test +--INI-- +error_log="{TMP}/GHSA-gr4f-wgx5-jpfv.log" +log_errors=1 +max_input_vars=1 +zend_test.warn_on_startup=1 +--FILE-- +<?php +echo "Hello world\n"; +?> +--EXPECTF-- +Warning: PHP Request Startup: Input variables exceeded 1. To increase the limit change max_input_vars in php.ini. in Unknown on line 0 +Hello world%r(?:\n\nWarning: Test startup warning from zend_test in Unknown on line 0)?%r diff --git a/ext/zend_test/php_test.h b/ext/zend_test/php_test.h index 89570d1155ce..e9e2ea5bde21 100644 --- a/ext/zend_test/php_test.h +++ b/ext/zend_test/php_test.h @@ -54,6 +54,7 @@ ZEND_BEGIN_MODULE_GLOBALS(zend_test) int replace_zend_execute_ex; int register_passes; bool print_stderr_mshutdown; + bool warn_on_startup; zend_long limit_copy_file_range; int observe_opline_in_zendmm; zend_mm_heap* zend_orig_heap; diff --git a/ext/zend_test/test.c b/ext/zend_test/test.c index a6cba8ddf401..bea3fe223f7a 100644 --- a/ext/zend_test/test.c +++ b/ext/zend_test/test.c @@ -614,6 +614,17 @@ static PHP_INI_MH(OnUpdateZendTestObserveOplineInZendMM) return OnUpdateBool(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage); } +static PHP_INI_MH(OnUpdateZendTestWarnOnStartup) +{ + zend_result result = OnUpdateBool(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage); + if (result == SUCCESS) { + if (*(bool *)ZEND_INI_GET_ADDR()) { + zend_error(E_WARNING, "Test startup warning from zend_test"); + } + } + return result; +} + static ZEND_FUNCTION(zend_test_is_pcre_bundled) { ZEND_PARSE_PARAMETERS_NONE(); @@ -1078,6 +1089,7 @@ PHP_INI_BEGIN() STD_PHP_INI_ENTRY("zend_test.str_test", "", PHP_INI_ALL, OnUpdateStr, str_test, zend_zend_test_globals, zend_test_globals) STD_PHP_INI_ENTRY("zend_test.not_empty_str_test", "val", PHP_INI_ALL, OnUpdateStrNotEmpty, not_empty_str_test, zend_zend_test_globals, zend_test_globals) STD_PHP_INI_BOOLEAN("zend_test.observe_opline_in_zendmm", "0", PHP_INI_ALL, OnUpdateZendTestObserveOplineInZendMM, observe_opline_in_zendmm, zend_zend_test_globals, zend_test_globals) + STD_PHP_INI_BOOLEAN("zend_test.warn_on_startup", "0", PHP_INI_SYSTEM, OnUpdateZendTestWarnOnStartup, warn_on_startup, zend_zend_test_globals, zend_test_globals) PHP_INI_END() void (*old_zend_execute_ex)(zend_execute_data *execute_data); diff --git a/main/main.c b/main/main.c index 4ff0c034f1bc..95da1bcf547f 100644 --- a/main/main.c +++ b/main/main.c @@ -858,15 +858,7 @@ PHPAPI ZEND_COLD void php_log_err_with_severity(const char *log_message, int sys zend_string *error_time_str; time(&error_time); -#ifdef ZTS - if (!php_during_module_startup()) { - error_time_str = php_format_date("d-M-Y H:i:s e", 13, error_time, 1); - } else { - error_time_str = php_format_date("d-M-Y H:i:s e", 13, error_time, 0); - } -#else - error_time_str = php_format_date("d-M-Y H:i:s e", 13, error_time, 1); -#endif + error_time_str = php_format_date("d-M-Y H:i:s e", 13, error_time, PG(modules_activated) && EG(active)); len = spprintf(&tmp, 0, "[%s] %s%s", ZSTR_VAL(error_time_str), log_message, PHP_EOL); #ifdef PHP_WIN32 php_flock(fd, LOCK_EX);

« previous php.cvs (#143909) next »