[php-src] Issue #13926: File system group permission with is_readable and is_writable is not being honored
| From: | SirLouen | Date: | Tue, 09 Apr 2024 15:21:11 +0000 |
| Subject: | [php-src] Issue #13926: File system group permission with is_readable and is_writable is not being honored | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-246728@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/13926
Author: SirLouen
### Description
# Server Context
- Operating system: Fedora 38
- Web server: nginx 1.24.0
- Database version: MariaDB 10.5.23
- PHP version: PHP 8.2.17
- phpMyAdmin version: phpMyAdmin 5.2.1-1.fc38
# The following code:
Script in
/var/www/test/info.php:
```php
<?php
echo exec('whoami') . PHP_EOL;
if (is_readable('/var/www/test/check.php'))
echo "OK";
else
echo "KO";
echo PHP_EOL;
if(!is_dir('/var/www/test/test_dir')) {
echo 'Nope. Nothing!'.PHP_EOL;
} else {
echo 'Found it!'.PHP_EOL;
}
```
With the following filesystems permissions:
```bash
# ll -a
drwxr-xr-x. 3 alcudia alcudia 4096 Apr 9 14:42 .
drwxr-xr-x. 7 root root 4096 Apr 9 01:40 ..
-rw-r-----. 1 nginx nginx 21 Apr 9 01:42 check.php
-rwxrwxrwx. 1 root root 252 Apr 9 14:42 info.php
dr-xr-x---. 2 nginx nginx 4096 Apr 9 14:42 test_dir
```
```
# lid -g nginx
nginx(uid=992)
alcudia(uid=1000)
```
# Resulted in this output:
Check the video:
https://github.com/php/php-src/assets/224787/704bfa51-ad06-454b-95b5-83cf562b8809
Every time I press F5, the result changes
# But I expected this output instead:
Just this exclusively:
```
alcudia OK Found it!
```
# Extra information:
It's interesting because I first discovered this while I was setting phpMyAdmin and raised this
issue:
https://github.com/phpmyadmin/phpmyadmin/issues/19106
### PHP Version
8.2.17
### Operating System
Fedora 38