@@ -1035,17 +1035,8 @@ static void init_request_info(void)
10351035 /* Copy path portion in place to avoid memory leak. Note
10361036 * that this also affects what script_path_translated points
10371037 * to. */
1038- size_t plen = strlen (p );
1039- memmove (env_script_filename , p , plen + 1 );
1038+ memmove (env_script_filename , p , strlen (p ) + 1 );
10401039 apache_was_here = 1 ;
1041- // If DocumentRoot contains cyrillic characters and PHP is invoked with SetHandler (not applicable to ProxyPassMatch),
1042- // then the cyrillic characters are urlencoded by apache, and we need to decode them, for example with
1043- // DocumentRoot /home/hans/web/cyrillicрф.ratma.net/public_html
1044- // env_script_filename contains /home/hans/web/cyrillic%D1%80%D1%84.ratma.net/public_html/index.php.
1045- // and we must decode it to /home/hans/web/cyrillicрф.ratma.net/public_html/index.php.
1046- if (memchr (env_script_filename , '%' , plen ) != NULL ){
1047- plen = php_raw_url_decode (env_script_filename , plen );
1048- }
10491040 }
10501041 /* ignore query string if sent by Apache (RewriteRule) */
10511042 p = strchr (env_script_filename , '?' );
@@ -1112,6 +1103,16 @@ static void init_request_info(void)
11121103 script_path_translated = __unixify (script_path_translated , 0 , NULL , 1 , 0 );
11131104#endif
11141105
1106+ // If DocumentRoot contains cyrillic characters and PHP is invoked with SetHandler (not applicable to ProxyPassMatch),
1107+ // then the cyrillic characters are urlencoded by apache, and we need to decode them, for example with
1108+ // DocumentRoot /home/hans/web/cyrillicрф.ratma.net/public_html
1109+ // env_script_filename contains /home/hans/web/cyrillic%D1%80%D1%84.ratma.net/public_html/index.php.
1110+ // and we must decode it to /home/hans/web/cyrillicрф.ratma.net/public_html/index.php.
1111+ if (apache_was_here && strchr (script_path_translated , '%' ))
1112+ {
1113+ php_raw_url_decode (script_path_translated , strlen (script_path_translated ));
1114+ }
1115+
11151116 /*
11161117 * if the file doesn't exist, try to extract PATH_INFO out
11171118 * of it by stat'ing back through the '/'
0 commit comments