Skip to content

Include path starting with '.' or '..' #9605

@jjjb03

Description

@jjjb03

Problem:
PSALM gives false positive errors of "cannot find file" if an include/require starts with '.' or '..'.

PSALM obviously uses the base path to resolve this as an relative path, but indeed PHP handles those paths in a special way, see documentation snippet below.

this was also stated in #268 (comment), but was not handled further.

from https://www.php.net/manual/en/function.include.php

If a path is defined — whether absolute (starting with a drive letter or \ on Windows, or / on Unix/Linux systems) or relative to the current directory (starting with . or ..) — the include_path will be ignored altogether. For example, if a filename begins with ../, the parser will look in the parent directory to find the requested file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions