-
Notifications
You must be signed in to change notification settings - Fork 11.3k
[5.1] [5.2] Error handler hides PHPUnit errors #10808
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
Comments
Ping @taylorotwell. |
Yeah I've been meaning to look into this :) ... thanks for the reminder! |
Ok, closing #10829. |
Hello, tried with PHPUnit 5.0.9 but I get the same error. Maybe something's unbinding the Handler implementation between cases? |
Got the same issue |
We ONLY support phpunit 4.8. |
Upgrading to 5.x means you have to drop php 5.5 support from your app. We've done that in L5.3. |
Reverted to phpunit 4.8 same exception |
Is this only with code coverage turned on? |
If so, you need to make sure phpunit doesn't load your routes file, or any other php files "with consequences". |
I can confirm that this also occurs on my build.. Here's the log that indicates the error:
Strangely, it only occurs when I tried to use PHP 5.6. Does not occur on HHVM or 7.0. Tested on Travis-CI |
I understand we don't want PhpUnit 5.x in Laravel 5 yet, all the related reasons. My question is: do we even know what is the cause and a possible solution? @taylorotwell |
with behat we have the same problem. |
Issue confirmed on my application with
Update: I had customised a bit the exception handler to have Whoops rendering but after reverting it to the original https://raw.githubusercontent.com/laravel/laravel/v5.1.4/app/Exceptions/Handler.php |
No need for confirmations please. We know it's broken. ;) |
@GrahamCampbell any ETA or anything I can do to speed the thing up? |
Well, if you could fix it, that would be great. The problem is somewhat non-trivial though, so good luck if you want to give it a go. ;) |
is there any fix / solution for this ? |
I am running into this issue as well. Any ideas on a fix for this yet @taylorotwell? For me, it is only happening when I run only a part of my tests with code coverage. PHP 5.6 and PHPUnit 4.8.24 |
I think I know what's going on here then, if it's only happening with code coverage. |
Make sure you exclude any plain php files such as your routes.php file. |
Excludes work like this: https://github.com/laravel/framework/blob/5.2/phpunit.xml#L24. |
@GrahamCampbell Code coverage is working if I run the whole suite... |
Can you try excluding that file please. |
I'm watching your stream. I'm pretty sure if you run all of phpunit with coverage on, then it'll break in the same way. |
I got the problem when an exception was thrown in Windows 10 x64 |
@casperbakker oh the joys of development. Ironically for me changing |
I can't for the life of me figure out why my solution works, I came upon it by trial and error. I suspect something is getting serialized improperly and/or handled by-reference having some weird effect. But I've found this to get triggered when the The solution for me, was go to line 546 and add the following:
From what I can tell, neither the content of Also, part of how I tracked this down was by replacing the instantiation call within Once I did that, I got past the BindingResolution error, and moved on to a warning stating that the "failedOrRisky" key on the |
If changing
Another problem can be a library for PHPUnit, on my case, was |
- Source and tests a little bit refactored - Blade directives use contract instead abstract container bind alias - Abstract tests bootstrapper class removed - PHPUnit HTML coverage report disabled by default ([container errors](laravel/framework#10808) after `composer update --no-interaction --prefer-lowest`)
Writing in to say that this error pops up (after a timeout) on dusk in laravel 5.6 on 'some' browser tests. Have been breaking my head on fixing this for days until I found this. It was fixed after changing processIsolation to true. May I propose using processIsolation true on default? Does that make sense? Versions:
|
As a followup. I found that adding
to |
I have the same problem in the bitbucket pipelines. I'm using the following versions
|
I have this issue. I've had no issues under ubuntu 16 + php.7.0 + laravel 5.5, but now under ubuntu 18 it seems to non-deterministicly break |
@dinandmentink i have exact same issue with dusk can you tell me where to add that exactly ? i.e. before prepare or driver or newbrowser method ? |
Ping @taylorotwell Now I gotta go into work Wednesday and explain to my boss, who is not an open-source fan, why it took days to find a trivial error in my config file. OK (36 tests, 2155 assertions) Generating code coverage report in PHP format ...PHP Fatal error: Uncaught Illuminate\Contracts\Container\BindingResolutionException: Target [Illuminate\Contracts\Debug\ExceptionHandler] is not instantiable. in /home/vagrant/repos/toto/vendor/laravel/framework/src/Illuminate/Container/Container.php:895 |
@jschlies you are free to fix the problem and submit a pull request, also you can contribute with the laravel framework before come here with ironies... |
@jschlies I second what @iget-master said. None of the contributors to Laravel or to other open-source projects are being paid for their efforts. Nor do they owe you anything. It's one thing to ask for help, but another to demand that they fix something for you, especially with the tone you used. Tell your boss there's a problem with a thing on the internet and the only way to fix it is to do some stuff. And if he doesn't that, tell them they're free to get the Oracle solution for $1 billion plus a lifetime support contract. |
Love beautiful code? Yea. |
Get with the flow of things or don't use the free software at all. Why are you feeling so entitled that a bug needs to be addressed in the next year or even the next 10 years when you're using what they develop for free? There's documentation for the api, framework and you can just read the source code itself to see how everything works. Not everyone who contributes back to the framework knows how every single part of the framework works. Does the bug affect you? yes? Is the bug a major breaking problem? yes? no? Make a report, wait for it to be fixed. Can't wait for it? Fix it yourself or use a different framework. Your tone in your posts are really way off, expecting people to fix things for you. |
My earlier comment got buried, but I have to refer you to it again. Also, never offer a tool blind faith, no matter how good. Neither open-source nor proprietary, nor even the scripting language itself will be without bugs. Besides, PHPUnit is framework-agnostic. This may not even be in the scope of Laravel to fix here, we could be taking this up in the wrong forum. |
I'm on php7.2 and laravel 5.7 now and it's still happening. possibly related, chrome driver has this output:
|
The workaround of kmuenkel does not work for me on laravel 5.5.45, PHP 7.1.12, PHPUnit 6.5.14, dusk 2.0.14. Neither does process isolation true and false work for me. But i created a workaround that does work for my situation. First extend you dusk test case. Then add this method on your test case:
When you get the Illuminate\Contracts\Container\BindingResolutionException you could use it like this for example
|
i started getting this when i am using a new vps for gitlab runner running hope someone will find fix for it. and as some more people facing issue, isn't time to make issue "open" ? thanks. |
I got the same issue. I try to catch exception when TestRunner is generating coverage
and got error message:
After change coverage directory permission to 755 from 555, It's work. Hope helpful.
|
This was happening for me, and it ended up being a permissions problem. |
If you don't need/use varnish Authentication, removing the following files in
"may" solve your problem... "maybe". Or if you use them check that you have the package "laravel/ui" And don't use process-isolation as your tests will be slow as hell. |
Hey good people. This worked for me. I followed the instructions above at 510725404 and received the following exception dump:
With:
running Xubuntu 20.04 on Oracle v6.1.16 So I googled the error and found this fix. And so I changed ./vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/File.php:307 from
And the error went away! This error only appeared when running tests posting logins. I hope this helps. |
In my case the issue was caused by a psr-0 autoload definition for Facebook SDK 3.2.2 in a legacy app that's running L8 in parallel with ZF1. Definitions are correct in autoload_classmap. It doesn't occur on our servers nor dev workstation only in our GitHub Action which is getting this error when running pest. The unit tests complete and the error occurs soon as the coverage begins in the GIthub Action. For the fix we removed any access to the legacy psr-0 Facebook sdk from the Laravel side and rewrote using Facebook's modern php-graph-sdk. Our legacy unit tests for ZF1 still work properly using the psr-0 version. |
I discovered a bug in PHPUnit (sebastianbergmann/phpunit#1935) while working on a Laravel 5.1 project:
The reason why I am opening this ticket is because nowhere in the stacktrace do I see PHPUnit and/or PHP_CodeCoverage. The fact that PHPUnit was not handling an exception raised by PHP_CodeCoverage was not apparent at all from looking at the error I got. Maybe the error handler is too eager?
The text was updated successfully, but these errors were encountered: