From 4b0e4573189266c13288169409f4974f03a2871c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Sun, 25 Apr 2021 16:27:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- System/Di/Service.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/System/Di/Service.php b/System/Di/Service.php index eebc0f48..b4fe0a15 100644 --- a/System/Di/Service.php +++ b/System/Di/Service.php @@ -51,8 +51,6 @@ class Service extends Component } throw new ComponentException("Unknown component ID: $id"); } - - $this->_ids[] = $id; if (isset($this->_definition[$id])) { $config = $this->_definition[$id]; if (is_object($config)) { @@ -88,6 +86,9 @@ class Service extends Component if ($definition === NULL) { return $this->remove($id); } + + $this->_ids[] = $id; + unset($this->_components[$id]); if (is_object($definition) || is_callable($definition, TRUE)) { return $this->_definition[$id] = $definition;