From ec68820d63dbe58851841043cedae90b0eed168d Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Thu, 9 Nov 2017 08:49:08 +0800 Subject: [PATCH] Throws an exception if null driver is given. Signed-off-by: Mior Muhammad Zaki --- src/Illuminate/Support/Manager.php | 4 ++++ .../Support/Fixtures/NullableManager.php | 18 ++++++++++++++++++ tests/Integration/Support/ManagerTest.php | 17 +++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 tests/Integration/Support/Fixtures/NullableManager.php create mode 100644 tests/Integration/Support/ManagerTest.php diff --git a/src/Illuminate/Support/Manager.php b/src/Illuminate/Support/Manager.php index 592776c2c859..e91268d530f9 100755 --- a/src/Illuminate/Support/Manager.php +++ b/src/Illuminate/Support/Manager.php @@ -56,6 +56,10 @@ public function driver($driver = null) { $driver = $driver ?: $this->getDefaultDriver(); + if (is_null($driver)) { + throw new InvalidArgumentException("Unable to resolve NULL driver for ".get_called_class()); + } + // If the given driver has not been created before, we will create the instances // here and cache it so we can return it next time very quickly. If there is // already a driver created by this name, we'll just return that instance. diff --git a/tests/Integration/Support/Fixtures/NullableManager.php b/tests/Integration/Support/Fixtures/NullableManager.php new file mode 100644 index 000000000000..09e3608ce73b --- /dev/null +++ b/tests/Integration/Support/Fixtures/NullableManager.php @@ -0,0 +1,18 @@ +app))->driver(); + } +}