[php-src] Issue #20972: The behavior of lstat is inconsistent with that in C
[email protected] (huye)
| Newsgroups | php.bugs |
|---|---|
| Message-ID | <IoM2oHYV9bkWoBvpU1FaUBJISjdf7rfFjdgr79TPy4o@main.internal.php.net> |
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_