-
-
Notifications
You must be signed in to change notification settings - Fork 603
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
Uncaught Whoops\Exception\ErrorException: Undefined index: _SERVER #485
Comments
could you elaborate why the superglobal |
I have a standard PHP 7.1.1 install and am not doing anything specific. I am actually using |
ok, different question: is |
For some reason, no. |
hmmm could you take a diff of your php.ini's used between 7.0/7.1 |
I can't seem to find any diff that has any relation to this issue, though. |
hmm not sure whats differnt in your env. per 3v4l the SERVER array should be available across PHP-version |
It appears to be xdebug that does something. In the 7.1-version, the xdebug module wasn't enabled (not even loaded). After enabling it, it all works. This seems... wrong? |
@derickr is this something you are aware of? does xdebug influence $GLOBALS ? |
No, it shouldn't do that. And I'm also not aware of it. Do you have a small reproducible case? |
I just tested in PHP 7.0, and even on another server with PHP 5.5.9 (just as a reference). None of them has You should be able to reproduce it by simply do a |
Oh, I read this the other way around! I thought you said that Xdebug removed something. I think it's because of this: https://github.com/xdebug/xdebug/blob/master/xdebug.c#L1033 — but I don't know whether that is still required in PHP 7.x. |
@magnus-eriksson Can you try this Xdebug patch? http://derickrethans.nl/files/dump/globals.patch.txt |
@derickr It's when xdebug isn't enabled the It simply seems like this is how PHP works (even back in version 5). I've never used My suggestion would be to do one of the following:
As it is right now, the library seems to depend on xdebug to be enabled, even though the same result could be produced without it. |
I realise that, but Xdebug should also not create these keys if it is loaded. That means we both have to fix something. Do you have something small for me to try to reproduce the Xdebug issue? And then you should also change your code so that it doesn't rely on the SERVeR key yo be there |
@derickr You can try my suggestion above to reproduce it: Simply do a var_dump($GLOBALS) and disable/enable xdebug. |
This makes little sense. PHP should always set FWIW, I can't reproduce this. |
@derickr I've tried it on Ubuntu 16.04 with PHP 7.0 and 7.1, with a standard LAMP stack, as well as on Ubuntu 14.04 with PHP 5.5, also with a standard LAMP stack. All showed the same behaviour. With xdebug enabled (xdebug.so loaded), I checked it by doing a |
So are you saying you don't have a
And the same for PHP 5.5.38 and 7.1.2. |
@derickr I see why you can't reproduce it. You're running it through CLI and I'm running it through Apache. If I'm running your script through cli, I get the same as you. Just now, I downloaded Ubuntu 16.04.2 Server from ubuntu.com and installed it as a new VM. I selected Ubuntu's LAMP-stack during install. Did a PHP Version
Content of index.php
Output
As you can see, |
Apparently: https://bugs.php.net/bug.php?id=65223 In Xdebug I force the parser to notice with the calls to |
So this looks like an example of "It's not a bug, it's a feature". :-) I would say that the conclusion would be that you should not count on |
Right, but it doesn't explain why it is different on the CLI... and I still ought to fix the Xdebug part of it :-) |
@magnus-eriksson please double check this fix #486 |
@staabm It's tested and confirmed to solve the issue. |
Fixed in #486, released as 2.1.8. Thank you for your report, and thank you for working so closely with us and helping us debug the problem, @magnus-eriksson! |
@denis-sokolov No problem. That's what Open Source is all about. You've made a great library and I'm just grateful to be able to help. :) Thank you for sorting it out quickly! |
You did not imply it directly, but here's for the benefit of future readers: @filp is the original author. I am but a long-term maintainer. |
Anytime my application throws an error (undefined variable or function, on exceptions etc), Whoops PrettyPageHandler shows me a pretty page (like it should) but the error is always the same. It's in the PrettyPageHandler itself.
The error occurs on row 666 (of course :)) in the PrettyPageHandler class:
This error happens in both version 2.1.6 and 2.1.7. It looks like the new blacklist feature was added in 2.1.6 and is the root of the problem.
I'm running PHP 7.1.1 on Ubuntu
The text was updated successfully, but these errors were encountered: