diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 47001d85bb3a2..b3dc70d042eff 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -1,7 +1,7 @@ name: Push on: push: - paths-ignore: + paths-ignore: &ignore_paths - docs/** - NEWS - UPGRADING @@ -18,16 +18,7 @@ on: - PHP-8.4 - master pull_request: - paths-ignore: - - docs/** - - NEWS - - UPGRADING - - UPGRADING.INTERNALS - - '**/README.*' - - CONTRIBUTING.md - - CODING_STANDARDS.md - - .cirrus.yml - - .circleci/** + paths-ignore: *ignore_paths branches: - '**' workflow_dispatch: ~ diff --git a/NEWS b/NEWS index cdabc59a8f836..6bd00000a1000 100644 --- a/NEWS +++ b/NEWS @@ -11,6 +11,8 @@ PHP NEWS array). (ilutov) . Fixed bug GH-19823 (register_argc_argv deprecation emitted twice when using OPcache). (timwolla) + . Fixed bug GH-19480 (error_log php.ini cannot be unset when open_basedir is + configured). (nielsdos) - Curl: . Fix cloning of CURLOPT_POSTFIELDS when using the clone operator instead diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index aa5c2a2cedfff..e0c4230dae27c 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -1988,10 +1988,8 @@ PHP_FUNCTION(ini_set) /* open basedir check */ if (PG(open_basedir)) { if ( - zend_string_equals_literal(varname, "error_log") - || zend_string_equals_literal(varname, "java.class.path") + zend_string_equals_literal(varname, "java.class.path") || zend_string_equals_literal(varname, "java.home") - || zend_string_equals_literal(varname, "mail.log") || zend_string_equals_literal(varname, "java.library.path") || zend_string_equals_literal(varname, "vpopmail.directory") ) { diff --git a/main/main.c b/main/main.c index db7de754143ac..e33ef29d61bb7 100644 --- a/main/main.c +++ b/main/main.c @@ -697,12 +697,13 @@ static PHP_INI_MH(OnUpdateErrorLog) { /* Only do the open_basedir check at runtime */ if ((stage == PHP_INI_STAGE_RUNTIME || stage == PHP_INI_STAGE_HTACCESS) && - new_value && zend_string_equals_literal(new_value, "syslog")) { + new_value && !zend_string_equals_literal(new_value, "syslog") && ZSTR_LEN(new_value) > 0) { if (PG(open_basedir) && php_check_open_basedir(ZSTR_VAL(new_value))) { return FAILURE; } } - OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage); + char **p = (char **) ZEND_INI_GET_ADDR(); + *p = new_value && ZSTR_LEN(new_value) > 0 ? ZSTR_VAL(new_value) : NULL; return SUCCESS; } /* }}} */ @@ -711,12 +712,13 @@ static PHP_INI_MH(OnUpdateErrorLog) static PHP_INI_MH(OnUpdateMailLog) { /* Only do the open_basedir check at runtime */ - if ((stage == PHP_INI_STAGE_RUNTIME || stage == PHP_INI_STAGE_HTACCESS) && new_value) { + if ((stage == PHP_INI_STAGE_RUNTIME || stage == PHP_INI_STAGE_HTACCESS) && new_value && ZSTR_LEN(new_value) > 0) { if (PG(open_basedir) && php_check_open_basedir(ZSTR_VAL(new_value))) { return FAILURE; } } - OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage); + char **p = (char **) ZEND_INI_GET_ADDR(); + *p = new_value && ZSTR_LEN(new_value) > 0 ? ZSTR_VAL(new_value) : NULL; return SUCCESS; } /* }}} */ diff --git a/tests/security/error_log_special_values.phpt b/tests/security/error_log_special_values.phpt new file mode 100644 index 0000000000000..949adb5e2538a --- /dev/null +++ b/tests/security/error_log_special_values.phpt @@ -0,0 +1,13 @@ +--TEST-- +Setting error_log to special values with open_basedir enabled +--INI-- +open_basedir=foo +error_log= +--FILE-- + +--EXPECT-- +string(0) "" +string(6) "syslog" diff --git a/win32/build/phpize.bat b/win32/build/phpize.bat index 57467d34231d0..a591d3f476443 100644 --- a/win32/build/phpize.bat +++ b/win32/build/phpize.bat @@ -1,7 +1,7 @@ @echo off SET PHP_BUILDCONF_PATH=%~dp0 cscript /nologo /e:jscript %PHP_BUILDCONF_PATH%\script\phpize.js %* -IF ERRORLEVEL 0 exit /b 3 +IF %ERRORLEVEL% NEQ 0 exit /b 3 IF NOT EXIST configure.bat ( echo Error generating configure script, configure script was not copied exit /b 3