From a1a9e24494b5b52625b561e0371dea6b6088d8dc Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Mon, 20 Apr 2020 16:37:33 +0200 Subject: [PATCH 1/2] Fix #79489: .user.ini does not inherit On Windows, PATH_TRANSLATED may contain backslashes as well as slashes, so we must not only check for `DEFAULT_SLASH`. --- sapi/cgi/cgi_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index 8c8e1463d5529..3408b1ddf2f01 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -843,7 +843,7 @@ static void php_cgi_ini_activate_user_config(char *path, size_t path_len, const if (strncmp(s1, s2, s_len) == 0) { #endif char *ptr = s2 + doc_root_len; - while ((ptr = strchr(ptr, DEFAULT_SLASH)) != NULL) { + while ((ptr = strpbrk(ptr, "\\/")) != NULL) { *ptr = 0; php_parse_user_ini_file(path, PG(user_ini_filename), entry->user_config); *ptr = '/'; From afa4e53cfdb4c7c9c17cd0856d92a33201dccf6a Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Tue, 5 May 2020 10:36:16 +0200 Subject: [PATCH 2/2] Check for slash and backslash only on Windows --- sapi/cgi/cgi_main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index 3408b1ddf2f01..37f8eac6e0e8d 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -843,7 +843,11 @@ static void php_cgi_ini_activate_user_config(char *path, size_t path_len, const if (strncmp(s1, s2, s_len) == 0) { #endif char *ptr = s2 + doc_root_len; +#ifdef PHP_WIN32 while ((ptr = strpbrk(ptr, "\\/")) != NULL) { +#else + while ((ptr = strchr(ptr, DEFAULT_SLASH)) != NULL) { +#endif *ptr = 0; php_parse_user_ini_file(path, PG(user_ini_filename), entry->user_config); *ptr = '/';