mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3: Fix GH-19480: error_log php.ini cannot be unset when open_basedir is configured
This commit is contained in:
2
NEWS
2
NEWS
@@ -12,6 +12,8 @@ PHP NEWS
|
||||
closures can cause a crash). (nielsdos, Arnaud, Bob)
|
||||
. Fixed bug GH-19839 (Incorrect HASH_FLAG_HAS_EMPTY_IND flag on userland
|
||||
array). (ilutov)
|
||||
. 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
|
||||
|
||||
@@ -2015,10 +2015,8 @@ PHP_FUNCTION(ini_set)
|
||||
#define _CHECK_PATH(var, var_len, ini) php_ini_check_path(var, var_len, ini, sizeof(ini))
|
||||
/* open basedir check */
|
||||
if (PG(open_basedir)) {
|
||||
if (_CHECK_PATH(ZSTR_VAL(varname), ZSTR_LEN(varname), "error_log") ||
|
||||
_CHECK_PATH(ZSTR_VAL(varname), ZSTR_LEN(varname), "java.class.path") ||
|
||||
if (_CHECK_PATH(ZSTR_VAL(varname), ZSTR_LEN(varname), "java.class.path") ||
|
||||
_CHECK_PATH(ZSTR_VAL(varname), ZSTR_LEN(varname), "java.home") ||
|
||||
_CHECK_PATH(ZSTR_VAL(varname), ZSTR_LEN(varname), "mail.log") ||
|
||||
_CHECK_PATH(ZSTR_VAL(varname), ZSTR_LEN(varname), "java.library.path") ||
|
||||
_CHECK_PATH(ZSTR_VAL(varname), ZSTR_LEN(varname), "vpopmail.directory")) {
|
||||
if (php_check_open_basedir(ZSTR_VAL(new_value_str))) {
|
||||
|
||||
12
main/main.c
12
main/main.c
@@ -667,12 +667,13 @@ static PHP_INI_MH(OnUpdateErrorLog)
|
||||
{
|
||||
/* Only do the safemode/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;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -680,13 +681,14 @@ static PHP_INI_MH(OnUpdateErrorLog)
|
||||
/* {{{ PHP_INI_MH */
|
||||
static PHP_INI_MH(OnUpdateMailLog)
|
||||
{
|
||||
/* Only do the safemode/open_basedir check at runtime */
|
||||
if ((stage == PHP_INI_STAGE_RUNTIME || stage == PHP_INI_STAGE_HTACCESS) && new_value) {
|
||||
/* Only do the open_basedir check at runtime */
|
||||
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;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
13
tests/security/error_log_special_values.phpt
Normal file
13
tests/security/error_log_special_values.phpt
Normal file
@@ -0,0 +1,13 @@
|
||||
--TEST--
|
||||
Setting error_log to special values with open_basedir enabled
|
||||
--INI--
|
||||
open_basedir=foo
|
||||
error_log=
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(ini_set("error_log", "syslog"));
|
||||
var_dump(ini_set("error_log", ""));
|
||||
?>
|
||||
--EXPECT--
|
||||
string(0) ""
|
||||
string(6) "syslog"
|
||||
Reference in New Issue
Block a user