Skip to content

Commit 18ad38a

Browse files
committed
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3: Fix #79491: Search for .user.ini extends up to root dir
2 parents 721ca87 + fa10abd commit 18ad38a

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ PHP NEWS
1515
. Fixed bug #79336 (ext/exif/tests/bug79046.phpt fails on Big endian arch).
1616
(Nikita)
1717

18+
- FCGI:
19+
. Fixed bug #79491 (Search for .user.ini extends up to root dir). (cmb)
20+
1821
- MBString:
1922
. Fixed bug #79441 (Segfault in mb_chr() if internal encoding is unsupported).
2023
(Girgias)

sapi/cgi/cgi_main.c

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

782782
/* {{{ php_cgi_ini_activate_user_config
783783
*/
784-
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)
784+
static void php_cgi_ini_activate_user_config(char *path, size_t path_len, const char *doc_root, size_t doc_root_len)
785785
{
786786
user_config_cache_entry *new_entry, *entry;
787787
time_t request_time = (time_t)sapi_get_request_time();
@@ -834,7 +834,7 @@ static void php_cgi_ini_activate_user_config(char *path, size_t path_len, const
834834
#else
835835
if (strncmp(s1, s2, s_len) == 0) {
836836
#endif
837-
char *ptr = s2 + start; /* start is the point where doc_root ends! */
837+
char *ptr = s2 + doc_root_len;
838838
while ((ptr = strchr(ptr, DEFAULT_SLASH)) != NULL) {
839839
*ptr = 0;
840840
php_parse_user_ini_file(path, PG(user_ini_filename), entry->user_config);
@@ -930,7 +930,7 @@ static int sapi_cgi_activate(void)
930930
doc_root = estrndup(doc_root, doc_root_len);
931931
zend_str_tolower(doc_root, doc_root_len);
932932
#endif
933-
php_cgi_ini_activate_user_config(path, path_len, doc_root, doc_root_len, (doc_root_len > 0 && (doc_root_len - 1)));
933+
php_cgi_ini_activate_user_config(path, path_len, doc_root, doc_root_len);
934934

935935
#ifdef PHP_WIN32
936936
efree(doc_root);

0 commit comments

Comments
 (0)