Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
jjjb03 opened this issue Apr 4, 2023 · 1 comment · Fixed by #9608
Closed

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

jjjb03 opened this issue Apr 4, 2023 · 1 comment · Fixed by #9608

Comments

@jjjb03
Copy link
Contributor

jjjb03 commented Apr 4, 2023

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.

@psalm-github-bot
Copy link

Hey @jjjb03, can you reproduce the issue on https://psalm.dev ?

clxmstaab pushed a commit to staabm/psalm that referenced this issue Apr 4, 2023
clxmstaab pushed a commit to staabm/psalm that referenced this issue Apr 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant