@@ -144,6 +144,7 @@ typedef struct _php_cgi_globals_struct {
144
144
bool nph ;
145
145
bool fix_pathinfo ;
146
146
bool discard_path ;
147
+ bool fcgi_script_path_encoded ;
147
148
bool fcgi_logging ;
148
149
bool fcgi_logging_request_started ;
149
150
HashTable user_config_cache ;
@@ -1066,6 +1067,10 @@ static void init_request_info(void)
1066
1067
}
1067
1068
}
1068
1069
1070
+ if (apache_was_here && !CGIG (fcgi_script_path_encoded )) {
1071
+ php_raw_url_decode (env_script_filename , strlen (env_script_filename ));
1072
+ }
1073
+
1069
1074
if (CGIG (fix_pathinfo )) {
1070
1075
struct stat st ;
1071
1076
char * real_path = NULL ;
@@ -1174,7 +1179,7 @@ static void init_request_info(void)
1174
1179
* it is probably also in SCRIPT_NAME and need to be removed
1175
1180
*/
1176
1181
size_t decoded_path_info_len = 0 ;
1177
- if (strchr (path_info , '%' )) {
1182
+ if (CGIG ( fcgi_script_path_encoded ) && strchr (path_info , '%' )) {
1178
1183
decoded_path_info = estrdup (path_info );
1179
1184
decoded_path_info_len = php_raw_url_decode (decoded_path_info , strlen (path_info ));
1180
1185
}
@@ -1421,13 +1426,14 @@ static void fastcgi_ini_parser(zval *arg1, zval *arg2, zval *arg3, int callback_
1421
1426
/* }}} */
1422
1427
1423
1428
PHP_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 )
1431
1437
PHP_INI_END ()
1432
1438
1433
1439
/* {{{ php_cgi_globals_ctor */
@@ -1437,6 +1443,7 @@ static void php_cgi_globals_ctor(php_cgi_globals_struct *php_cgi_globals)
1437
1443
php_cgi_globals -> nph = 0 ;
1438
1444
php_cgi_globals -> fix_pathinfo = 1 ;
1439
1445
php_cgi_globals -> discard_path = 0 ;
1446
+ php_cgi_globals -> fcgi_script_path_encoded = 0 ;
1440
1447
php_cgi_globals -> fcgi_logging = 1 ;
1441
1448
php_cgi_globals -> fcgi_logging_request_started = false;
1442
1449
zend_hash_init (& php_cgi_globals -> user_config_cache , 0 , NULL , user_config_cache_entry_dtor , 1 );
0 commit comments