diff options
| author | wbender <wbender@nmi.com> | 2020-01-03 09:29:12 -0600 |
|---|---|---|
| committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-01-24 15:33:55 +0100 |
| commit | 98bfad738ad2734dfba5733323f7ba733daf3ec3 (patch) | |
| tree | 74e39a58e615ca923c6d462234dc96cfd42f9778 | |
| parent | 9b9436d9b0b4bd72b2997462ce74f442e3b736c1 (diff) | |
| download | php-git-98bfad738ad2734dfba5733323f7ba733daf3ec3.tar.gz | |
Fix bug #64865: Use CONTEXT_DOCUMENT_ROOT for scanning dir tree
If CONTEXT_DOCUMENT_ROOT is set use that rather than DOCUMENT_ROOT to
scan up the dir tree looking for .user.ini files.
Closes GH-5051.
| -rw-r--r-- | NEWS | 4 | ||||
| -rw-r--r-- | UPGRADING | 4 | ||||
| -rw-r--r-- | sapi/cgi/cgi_main.c | 7 | ||||
| -rw-r--r-- | sapi/fpm/fpm/fpm_main.c | 5 |
4 files changed, 17 insertions, 3 deletions
@@ -25,6 +25,10 @@ PHP NEWS . Add property DOMXPath::$registerNodeNamespaces and constructor argument that allow global flag to configure query() or evaluate() calls. +- FPM: + . Fixed bug #64865 (Search for .user.ini files from script dir up to + CONTEXT_DOCUMENT_ROOT). (Will Bender) + - GD: . Fixed bug #55005 (imagepolygon num_points requirement). (cmb) . Replaced gd resources with objects. (Mark Randall) @@ -371,6 +371,10 @@ PHP 8.0 UPGRADE NOTES 3. Changes in SAPI modules ======================================== +- CGI and FPM will now use CONTEXT_DOCUMENT_ROOT to scan for .user.ini files, + if it is defined. Otherwise, DOCUMENT_ROOT will be used as before. This + improves support for Apache mod_userdir and mod_alias. + ======================================== 4. Deprecated Functionality ======================================== diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index 3bd1d2d0d4..10f92d9fd3 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -913,9 +913,12 @@ static int sapi_cgi_activate(void) if (fcgi_is_fastcgi()) { fcgi_request *request = (fcgi_request*) SG(server_context); - doc_root = FCGI_GETENV(request, "DOCUMENT_ROOT"); + /* Prefer CONTEXT_DOCUMENT_ROOT if set */ + doc_root = FCGI_GETENV(request, "CONTEXT_DOCUMENT_ROOT"); + doc_root = doc_root ? doc_root : FCGI_GETENV(request, "DOCUMENT_ROOT"); } else { - doc_root = getenv("DOCUMENT_ROOT"); + doc_root = getenv("CONTEXT_DOCUMENT_ROOT"); + doc_root = doc_root ? doc_root : getenv("DOCUMENT_ROOT"); } /* DOCUMENT_ROOT should also be defined at this stage..but better check it anyway */ if (doc_root) { diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c index 5a7d3cb320..d00c0c2795 100644 --- a/sapi/fpm/fpm/fpm_main.c +++ b/sapi/fpm/fpm/fpm_main.c @@ -733,7 +733,10 @@ static int sapi_cgi_activate(void) /* {{{ */ /* Load and activate user ini files in path starting from DOCUMENT_ROOT */ if (PG(user_ini_filename) && *PG(user_ini_filename)) { - doc_root = FCGI_GETENV(request, "DOCUMENT_ROOT"); + /* Prefer CONTEXT_DOCUMENT_ROOT if set */ + doc_root = FCGI_GETENV(request, "CONTEXT_DOCUMENT_ROOT"); + doc_root = doc_root ? doc_root : FCGI_GETENV(request, "DOCUMENT_ROOT"); + /* DOCUMENT_ROOT should also be defined at this stage..but better check it anyway */ if (doc_root) { doc_root_len = strlen(doc_root); |
