summaryrefslogtreecommitdiff
path: root/sapi
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2000-08-05 11:28:32 +0000
committerStanislav Malyshev <stas@php.net>2000-08-05 11:28:32 +0000
commitdb0872123bdef984596a6e8bbff62ffcaf3d7129 (patch)
tree460697c80c84739acca189848dc6a29830462b4f /sapi
parent8b9ecac2dc2972819000d3f985a74a7fc31580f2 (diff)
downloadphp-git-db0872123bdef984596a6e8bbff62ffcaf3d7129.tar.gz
Fix crash on broken setups (#5979)
Diffstat (limited to 'sapi')
-rw-r--r--sapi/cgi/cgi_main.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
index 10d5d39059..a985ebee22 100644
--- a/sapi/cgi/cgi_main.c
+++ b/sapi/cgi/cgi_main.c
@@ -669,11 +669,15 @@ any .htaccess restrictions anywhere on your site you can leave doc_root undefine
or user_dir configuration directives, PATH_INFO is used to construct
the filename as a side effect of php_fopen_primary_script.
*/
+ char *env_path_translated=NULL;
#if DISCARD_PATH
- SG(request_info).path_translated = estrdup(getenv("SCRIPT_FILENAME"));
+ env_path_translated = getenv("SCRIPT_FILENAME");
#else
- SG(request_info).path_translated = estrdup(getenv("PATH_TRANSLATED"));
+ env_path_translated = getenv("PATH_TRANSLATED");
#endif
+ if(env_path_translated) {
+ SG(request_info).path_translated = estrdup(env_path_translated);
+ }
}
if (cgi || SG(request_info).path_translated) {
file_handle.handle.fp = php_fopen_primary_script();