From ea75c7ccec9ca5f8058817d4fe559302ac8213f1 Mon Sep 17 00:00:00 2001 From: PeopleSea Date: Fri, 28 Jun 2024 14:14:31 +0800 Subject: [PATCH] fix(config-provider): ensure class_exists before instantiation preservefix(config-provider): ensure class_exists before instantiation Fixed an issue in ConfigProvider where a class was being instantiated without first checking if it exists. An error occurred while executing the `php bin/hyperf.php server:watch` command --- src/ConfigProvider.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ConfigProvider.php b/src/ConfigProvider.php index ccf0a98..2903333 100644 --- a/src/ConfigProvider.php +++ b/src/ConfigProvider.php @@ -37,7 +37,7 @@ public function __invoke() foreach ($mineJsonPaths as $jsonPath) { if (file_exists($jsonPath->getPath() . '/' . Plugin::INSTALL_LOCK_FILE)) { $info = json_decode(file_get_contents($jsonPath->getRealPath()), true); - if (! empty($info['composer']['config'])) { + if (! empty($info['composer']['config']) && class_exists($info['composer']['config'])) { $provider = (new ($info['composer']['config']))(); $initialConfig = array_merge_recursive($provider, $initialConfig); }