Skip to content

Commit 193cb97

Browse files
committed
Merge branch 'PHP-7.4'
* PHP-7.4: Fix #79491: Search for .user.ini extends up to root dir
2 parents ae5d7e4 + 18ad38a commit 193cb97

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

sapi/cgi/cgi_main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ static void sapi_cgi_log_message(char *message, int syslog_type_int)
775775

776776
/* {{{ php_cgi_ini_activate_user_config
777777
*/
778-
static void php_cgi_ini_activate_user_config(char *path, size_t path_len, const char *doc_root, size_t doc_root_len, int start)
778+
static void php_cgi_ini_activate_user_config(char *path, size_t path_len, const char *doc_root, size_t doc_root_len)
779779
{
780780
user_config_cache_entry *new_entry, *entry;
781781
time_t request_time = (time_t)sapi_get_request_time();
@@ -828,7 +828,7 @@ static void php_cgi_ini_activate_user_config(char *path, size_t path_len, const
828828
#else
829829
if (strncmp(s1, s2, s_len) == 0) {
830830
#endif
831-
char *ptr = s2 + start; /* start is the point where doc_root ends! */
831+
char *ptr = s2 + doc_root_len;
832832
while ((ptr = strchr(ptr, DEFAULT_SLASH)) != NULL) {
833833
*ptr = 0;
834834
php_parse_user_ini_file(path, PG(user_ini_filename), entry->user_config);
@@ -927,7 +927,7 @@ static int sapi_cgi_activate(void)
927927
doc_root = estrndup(doc_root, doc_root_len);
928928
zend_str_tolower(doc_root, doc_root_len);
929929
#endif
930-
php_cgi_ini_activate_user_config(path, path_len, doc_root, doc_root_len, (doc_root_len > 0 && (doc_root_len - 1)));
930+
php_cgi_ini_activate_user_config(path, path_len, doc_root, doc_root_len);
931931

932932
#ifdef PHP_WIN32
933933
efree(doc_root);

0 commit comments

Comments
 (0)