[php-src] PR #17083: handle apache DocumentRoot cyrillic encoding
| From: | divinity76 | Date: | Sun, 08 Dec 2024 00:19:44 +0000 |
| Subject: | [php-src] PR #17083: handle apache DocumentRoot cyrillic encoding | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-29933@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/17083
Author: divinity76
When Apache's DocumentRoot contains cyrillic characters like
```
DocumentRoot /home/hans/web/cyrillicрф.ratma.net/public_html
```
and PHP is invoked with SetHandler (*PS not applicable to ProxySetMatch, the problem occurs with
SetHandler specifically) like
```
DocumentRoot /home/hans/web/cyrillicрф.ratma.net/public_html
<FilesMatch \.php$>
SetHandler "proxy:unix:/run/php/php8.3-fpm-cyrillicрф.ratma.net.sock"
</FilesMatch>
```
then apache will url-encode the cyrillic characters before sending it to fpm, so env_script_filename
will contain
```
/home/hans/web/cyrillic%D1%80%D1%84.ratma.net/public_html/index.php
```
and we need to url-decode it to
```
/home/hans/web/cyrillicрф.ratma.net/public_html/index.php
```
otherwise we hit that
```c
zlog(ZLOG_DEBUG, "Primary script unknown");
SG(sapi_headers).http_response_code = 404;
PUTS("File not found.\n");
```
error code path.