@@ -144,6 +144,7 @@ typedef struct _php_cgi_globals_struct {
144144 bool nph ;
145145 bool fix_pathinfo ;
146146 bool discard_path ;
147+ bool fcgi_script_path_encoded ;
147148 bool fcgi_logging ;
148149 bool fcgi_logging_request_started ;
149150 HashTable user_config_cache ;
@@ -1066,6 +1067,10 @@ static void init_request_info(void)
10661067 }
10671068 }
10681069
1070+ if (apache_was_here && !CGIG (fcgi_script_path_encoded )) {
1071+ php_raw_url_decode (env_script_filename , strlen (env_script_filename ));
1072+ }
1073+
10691074 if (CGIG (fix_pathinfo )) {
10701075 struct stat st ;
10711076 char * real_path = NULL ;
@@ -1174,7 +1179,7 @@ static void init_request_info(void)
11741179 * it is probably also in SCRIPT_NAME and need to be removed
11751180 */
11761181 size_t decoded_path_info_len = 0 ;
1177- if (strchr (path_info , '%' )) {
1182+ if (CGIG ( fcgi_script_path_encoded ) && strchr (path_info , '%' )) {
11781183 decoded_path_info = estrdup (path_info );
11791184 decoded_path_info_len = php_raw_url_decode (decoded_path_info , strlen (path_info ));
11801185 }
@@ -1421,13 +1426,14 @@ static void fastcgi_ini_parser(zval *arg1, zval *arg2, zval *arg3, int callback_
14211426/* }}} */
14221427
14231428PHP_INI_BEGIN ()
1424- STD_PHP_INI_BOOLEAN ("cgi.rfc2616_headers" , "0" , PHP_INI_ALL , OnUpdateBool , rfc2616_headers , php_cgi_globals_struct , php_cgi_globals )
1425- STD_PHP_INI_BOOLEAN ("cgi.nph" , "0" , PHP_INI_ALL , OnUpdateBool , nph , php_cgi_globals_struct , php_cgi_globals )
1426- STD_PHP_INI_BOOLEAN ("cgi.fix_pathinfo" , "1" , PHP_INI_SYSTEM , OnUpdateBool , fix_pathinfo , php_cgi_globals_struct , php_cgi_globals )
1427- STD_PHP_INI_BOOLEAN ("cgi.discard_path" , "0" , PHP_INI_SYSTEM , OnUpdateBool , discard_path , php_cgi_globals_struct , php_cgi_globals )
1428- STD_PHP_INI_BOOLEAN ("fastcgi.logging" , "1" , PHP_INI_SYSTEM , OnUpdateBool , fcgi_logging , php_cgi_globals_struct , php_cgi_globals )
1429- STD_PHP_INI_ENTRY ("fastcgi.error_header" , NULL , PHP_INI_SYSTEM , OnUpdateString , error_header , php_cgi_globals_struct , php_cgi_globals )
1430- STD_PHP_INI_ENTRY ("fpm.config" , NULL , PHP_INI_SYSTEM , OnUpdateString , fpm_config , php_cgi_globals_struct , php_cgi_globals )
1429+ STD_PHP_INI_BOOLEAN ("cgi.rfc2616_headers" , "0" , PHP_INI_ALL , OnUpdateBool , rfc2616_headers , php_cgi_globals_struct , php_cgi_globals )
1430+ STD_PHP_INI_BOOLEAN ("cgi.nph" , "0" , PHP_INI_ALL , OnUpdateBool , nph , php_cgi_globals_struct , php_cgi_globals )
1431+ STD_PHP_INI_BOOLEAN ("cgi.fix_pathinfo" , "1" , PHP_INI_SYSTEM , OnUpdateBool , fix_pathinfo , php_cgi_globals_struct , php_cgi_globals )
1432+ STD_PHP_INI_BOOLEAN ("cgi.discard_path" , "0" , PHP_INI_SYSTEM , OnUpdateBool , discard_path , php_cgi_globals_struct , php_cgi_globals )
1433+ STD_PHP_INI_BOOLEAN ("fastcgi.script_path_encoded" , "0" , PHP_INI_SYSTEM , OnUpdateBool , fcgi_script_path_encoded , php_cgi_globals_struct , php_cgi_globals )
1434+ STD_PHP_INI_BOOLEAN ("fastcgi.logging" , "1" , PHP_INI_SYSTEM , OnUpdateBool , fcgi_logging , php_cgi_globals_struct , php_cgi_globals )
1435+ STD_PHP_INI_ENTRY ("fastcgi.error_header" , NULL , PHP_INI_SYSTEM , OnUpdateString , error_header , php_cgi_globals_struct , php_cgi_globals )
1436+ STD_PHP_INI_ENTRY ("fpm.config" , NULL , PHP_INI_SYSTEM , OnUpdateString , fpm_config , php_cgi_globals_struct , php_cgi_globals )
14311437PHP_INI_END ()
14321438
14331439/* {{{ php_cgi_globals_ctor */
@@ -1437,6 +1443,7 @@ static void php_cgi_globals_ctor(php_cgi_globals_struct *php_cgi_globals)
14371443 php_cgi_globals -> nph = 0 ;
14381444 php_cgi_globals -> fix_pathinfo = 1 ;
14391445 php_cgi_globals -> discard_path = 0 ;
1446+ php_cgi_globals -> fcgi_script_path_encoded = 0 ;
14401447 php_cgi_globals -> fcgi_logging = 1 ;
14411448 php_cgi_globals -> fcgi_logging_request_started = false;
14421449 zend_hash_init (& php_cgi_globals -> user_config_cache , 0 , NULL , user_config_cache_entry_dtor , 1 );
0 commit comments