[php-src] Issue #20972: The behavior of lstat is inconsistent with that in C
| From: | huye | Date: | Mon, 19 Jan 2026 04:00:27 +0000 |
| Subject: | [php-src] Issue #20972: The behavior of lstat is inconsistent with that in C | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-251567@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/20972
Author: huye
### Description
When calling lstat on a dangling symbolic link file, it fails to retrieve the inode data of the
linked file and directly returns false. I understand that this might be the original design, but the
behavior should not differ from that in C. Furthermore, whether the linked target file can be
accessed is originally the responsibility of stat, so why should lstat also be unable to read it?
### PHP Version
```plain
PHP 8.4.12 (cli) (built: Aug 26 2025 13:36:28) (NTS)
Copyright (c) The PHP Group
Built by Homebrew
Zend Engine v4.4.12, Copyright (c) Zend Technologies
with Zend OPcache v8.4.12, Copyright (c), by Zend Technologies
```
### Operating System
_No response_