Skip to content

FILE_EXTERNAL breaks __DIR__ #6025

Open
@Bilge

Description

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature/phptEnd-to-end tests in PHPT formattype/bugSomething is broken

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions