-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Running phpunit-7.4.0.phar with phpdbg throws NOTICE #3352
Comments
I cannot reproduce this.
Maybe you have an auto-prepend script configured that |
No auto-prepend script. phpdbg runs in a Docker Container with PHP 7.2 coming from Alpine 3.8. |
Ok, even weirder, this does look like phpdbg specific behavior. $GLOBALS['_SERVER'] is only set after $_SERVER is accessed:
|
Sorry, but this does not look like a PHPUnit problem to me. |
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. |
You can run phpunit with phpdbg setting directly auto_globals_jit variable like this
|
This is the same problem as #3514. It was reproduced in the Docker-based reproducer repo I made. PHPUnit expects the key to always be there, but that's not compatible with |
It's not only a docker issue. Here's a reproducer that also fails on OS X:
|
@sebastianbergmann do you still consider it NOT a phpunit problem? |
I still cannot reproduce this:
|
It might be PHP 7.2 issue only :( |
Maybe xDebug messes with it, we don't have it enabled in the Docker reproducer? |
Without Xdebug I can reproduce it:
|
Nope, just tried 7.2 and 7.3, both work the same.
\o/ |
To clarify, you can rely on GLOBALS is broken and auto_globals_jit just cannot work with it as everyone expects (me included), and we can't remove I'm not precisely sure of the reason that xdebug should make a difference, but whatever it doesn't make much sense to load a debugger inside a debugger, the two cannot be expected to inter-operate properly ... |
The thing is the issue can only be observed if xdebug is not loaded. |
So I looked at Xdebug ... The reason it doesn't happen when Xdebug is loaded is because auto_globals_jit behaviour is not preserved, upon startup, Xdebug does this:
Which is forcing all super globals to be populated before you accessed them, and so you do not see this behaviour ... |
Yes, as I need to be able to reach them to read the headers to find out whether Xdebug needs to start a debug session or not. And then the others are needed to show the information from the super globals through debugging. |
phpunit installed via phive.
When calling
phpdbg -qrr /usr/local/bin/phpunit
the folling NOTICE is shown:Guess that $_SERVER is simply not set in phpdbg?
This line raises the notice, I guess in build/binary-phar-autoload.php.in:
The text was updated successfully, but these errors were encountered: