framework: Internal dependency issue (Illuminate\Contracts\Debug\ExceptionHandler)
- Laravel Version: 5.3.16
- PHP Version: 7.0.8
- Database Driver & Version: MySQL 5.7.16
Description:
I started using Illuminate Database for a project, in isolation from the rest of the Laravel framework using composer require illuminate/database
with the latest version.
A mistake with the connection configuration triggers the following error message, which doesn’t describe the problem at all, and doesn’t give any indication as to where the actual issue is:
PHP Fatal error: Uncaught Illuminate\Contracts\Container\BindingResolutionException: Target [Illuminate\Contracts\Debug\ExceptionHandler] is not instantiable. in vendor/illuminate/container/Container.php:763
Stack trace:
#0 vendor/illuminate/container/Container.php(644): Illuminate\Container\Container->build('Illuminate\\Cont...', Array)
#1 vendor/illuminate/database/Connectors/ConnectionFactory.php(130): Illuminate\Container\Container->make('Illuminate\\Cont...')
#2 [internal function]: Illuminate\Database\Connectors\ConnectionFactory->Illuminate\Database\Connectors\{closure}()
#3 vendor/illuminate/database/Connection.php(964): call_user_func(Object(Closure))
#4 vendor/phpgt/database/src/Query/SqlQuery.php(46): Illuminate\Database\Connection->getPdo()
#5 vendor/phpgt/database/src/Query/SqlQuery.php(17): Gt\Database\Query\SqlQuery- in vendor/illuminate/container/Container.php on line 763
Steps To Reproduce:
When adding the database connection using Illuminate\Database\Capsule\Manager::addConnection
(as described in the Database readme, line 5), I had a typo on the “charset” value. Instead of “utf8”, my associative array contained “utf-8”.
Further on in my code, I called Illuminate\Database\Connection::getPdo
, which causes the above error to be output.
I assume the problem is a dependency issue between internal Laravel/Illuminate packages, so that an exception like “Invalid MySQL configuration” isn’t being able to be thrown.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 1
- Comments: 17 (3 by maintainers)
To confirm, the reason this issue comes up is almost definitely because your database connection settings are wrong, but this issue is reporting the lack of understandable error message by Laravel which could easily say “unable to connect to database”, but instead gives you a BindingResolutionException.
This is fixed in 5.4
Any update on this? I’ve got some devs who are sure that their DB configuration info is correct, but they’re still running into this exception with no useful error information.
I see the issue. We can probably issue a fix fairly easy.