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

PHP's auto_globals_jit=1 makes the PHAR unusable on some runtimes #3514

Closed
dkarlovi opened this issue Feb 5, 2019 · 5 comments
Closed

PHP's auto_globals_jit=1 makes the PHAR unusable on some runtimes #3514

dkarlovi opened this issue Feb 5, 2019 · 5 comments

Comments

@dkarlovi
Copy link

dkarlovi commented Feb 5, 2019

Q A
PHPUnit version 7.x, 8.x
PHP version 7.2
Installation Method PHAR

If you run with auto_globals_jit=1 (which seems to be the default in PHP 7.2), you might get an error

[Uncaught TypeError in /tools/phpunit on line 18]
TypeError: realpath() expects parameter 1 to be a valid path, null given in /tools/phpunit:18
Stack trace:
#0 /tools/phpunit(18): realpath(NULL)
#1 {main}

or a notice about missing _SERVER in $GLOBALS (depening on the PHP's current error level, I guess).

It looks like it's because of

if (__FILE__ === realpath($GLOBALS['_SERVER']['SCRIPT_NAME'])) {

@sebastianbergmann sebastianbergmann changed the title [Bug] PHP's auto_globals_jit=1 makes the PHAR unusable on some runtimes PHP's auto_globals_jit=1 makes the PHAR unusable on some runtimes Feb 6, 2019
@sebastianbergmann
Copy link
Owner

Thank you for your report.

Please provide a minimal, self-contained, reproducing test case that shows the problem you are reporting.

Without such a minimal, self-contained, reproducing test case I will not be able to investigate this issue.

@dkarlovi
Copy link
Author

dkarlovi commented Feb 6, 2019

Here is a reproducer repo:
https://github.com/dkarlovi/reproducer-phpunit-3514

Sorry about it being in a Docker image, it's the only way I've managed to reproduce it for sure. Not sure why it's not longer outputting the exact error as before.

The PHAR used is downloaded like this:
https://github.com/jakzal/toolbox/blob/0d3710c9a0a02df61a265ea10d32b315df27a3f3/resources/tools.json#L561-L585

@sebastianbergmann
Copy link
Owner

Sorry, but this does not fit into my workflow.

@dkarlovi
Copy link
Author

dkarlovi commented Feb 6, 2019

I understand, feel free to close the issue if no value was created here. 👍

@dkarlovi
Copy link
Author

dkarlovi commented Feb 7, 2019

FYI duplicate of #3352.

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

No branches or pull requests

2 participants