diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2017-03-19 22:09:47 +0100 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2017-03-21 08:52:20 +0100 |
commit | 246e9ce547fa885f4335a2bca04ad4f3c559c8e7 (patch) | |
tree | 5ff3c8e2f2a6cc918865e8576bd629f5b6122562 /lib | |
parent | df1468481779e2193ad679a7edf5f87fc575ca38 (diff) | |
download | nextcloud-server-246e9ce547fa885f4335a2bca04ad4f3c559c8e7.tar.gz nextcloud-server-246e9ce547fa885f4335a2bca04ad4f3c559c8e7.zip |
More elegant handling of recursion
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/AppFramework/DependencyInjection/DIContainer.php | 10 | ||||
-rw-r--r-- | lib/private/ServerContainer.php | 2 |
2 files changed, 8 insertions, 4 deletions
diff --git a/lib/private/AppFramework/DependencyInjection/DIContainer.php b/lib/private/AppFramework/DependencyInjection/DIContainer.php index a6251557f6c..354b93873e9 100644 --- a/lib/private/AppFramework/DependencyInjection/DIContainer.php +++ b/lib/private/AppFramework/DependencyInjection/DIContainer.php @@ -559,13 +559,17 @@ class DIContainer extends SimpleContainer implements IAppContainer { }); } - public function query($name, $checkServerContainer = true) { + public function query($name) { $name = $this->sanitizeName($name); + try { return parent::query($name); } catch (QueryException $e) { - if ($checkServerContainer === false) { - throw $e; + if (strpos($name, 'OCA\\') === 0 && substr_count($name, '\\') >= 2) { + $segments = explode('\\', $name); + if (strtolower($segments[1]) === strtolower($this['AppName'])) { + throw new QueryException(); + } } } diff --git a/lib/private/ServerContainer.php b/lib/private/ServerContainer.php index 85229e364ad..df0293addf7 100644 --- a/lib/private/ServerContainer.php +++ b/lib/private/ServerContainer.php @@ -79,7 +79,7 @@ class ServerContainer extends SimpleContainer { $segments = explode('\\', $name); $appContainer = $this->getAppContainer(strtolower($segments[1])); try { - return $appContainer->query($name, false); + return $appContainer->query($name); } catch (QueryException $e) { // Didn't find the service in the respective app container, // ignore it and fall back to the core container. |