php / php/php-src

The behavior of lstat is inconsistent with that in C

Open
#20,972 0 comments 0 reactions 1 assignee View on GitHub

@bukka is already working on this.

Since Jan 19, 2026.

Bug Status: Needs Triage
Dominant language
C
Stars
40.4k
Forks
8.1k
Avg merge
2d 13h
Merged PRs (30d)
96

Description

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
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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.