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

FILE_EXTERNAL breaks __DIR__ #6025

Open
Bilge opened this issue Nov 4, 2024 · 0 comments
Open

FILE_EXTERNAL breaks __DIR__ #6025

Bilge opened this issue Nov 4, 2024 · 0 comments
Labels
feature/phpt End-to-end tests in PHPT format type/bug Something is broken

Comments

@Bilge
Copy link
Contributor

Bilge commented Nov 4, 2024

Q A
PHPUnit version 11.3.6
PHP version 8.2.15
Installation Method Composer

Summary

An external PHP source file referenced by FILE_EXTERNAL breaks assumptions about __DIR__ pointing to directory of the source file so referenced.

Current behavior

It seems __DIR__ resolves to the directory of the test file including the source so specified in the FILE_EXTERNAL section, instead of the external file itself.

How to reproduce

# my.phpt

--FILE_EXTERNAL--
../external.php
# ../external.php

echo __DIR__, "\n";

Expected behavior

Should print the parent directory of my.phpt.
Currently prints the same directory as my.phpt.

@Bilge Bilge added the type/bug Something is broken label Nov 4, 2024
@sebastianbergmann sebastianbergmann added the feature/phpt End-to-end tests in PHPT format label Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/phpt End-to-end tests in PHPT format type/bug Something is broken
Projects
None yet
Development

No branches or pull requests

2 participants