phpunit: Running phpunit-7.4.0.phar with phpdbg throws NOTICE
Q | A |
---|---|
PHPUnit version | 7.4.0 |
PHP version | phpdbg 7.2.10 |
Installation Method | PHAR |
phpunit installed via phive.
When calling phpdbg -qrr /usr/local/bin/phpunit
the folling NOTICE is shown:
[PHP Notice: Undefined index: _SERVER in /usr/local/bin/phpunit on line 18]
Guess that $_SERVER is simply not set in phpdbg?
This line raises the notice, I guess in build/binary-phar-autoload.php.in:
if (__FILE__ === realpath($GLOBALS['_SERVER']['SCRIPT_NAME'])) {
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 19 (8 by maintainers)
Commits related to this issue
- Closes #3352 — committed to sebastianbergmann/phpunit by sebastianbergmann 5 years ago
Sorry, but this does not look like a PHPUnit problem to me.
According to @krakjoe and @nikic, there might be an interoperability issue between PHPDBG and Xdebug here that hides a problem in PHPUnit’s code. That problem is that one cannot rely on
$_SERVER
being defined.CC @derickr on the off chance that is relevant to Xdebug development.
Without Xdebug I can reproduce it:
It’s not only a docker issue. Here’s a reproducer that also fails on OS X:
[PHP Notice: Undefined index: _SERVER in /Users/kuba/phpunit on line 18]
You can run phpunit with phpdbg setting directly auto_globals_jit variable like this
phpdbg -dauto_globals_jit=Off -qrr /usr/local/bin/phpunit
I just ran into this myself in exactly the same scenario. Found this:
https://odd.blog/2015/02/12/php-notice-undefined-variable-_server-in/
Setting “auto_globals_jit = Off” does seem to fix it.