diff --git a/lib/private/AppFramework/Utility/SimpleContainer.php b/lib/private/AppFramework/Utility/SimpleContainer.php index 0c1e93caa590..6d5f2bae0529 100644 --- a/lib/private/AppFramework/Utility/SimpleContainer.php +++ b/lib/private/AppFramework/Utility/SimpleContainer.php @@ -107,9 +107,9 @@ public function resolve($name) { */ public function query($name) { $name = $this->sanitizeName($name); - if ($this->offsetExists($name)) { + try { return $this->offsetGet($name); - } else { + } catch (\InvalidArgumentException $ex) { $object = $this->resolve($name); $this->registerService($name, function () use ($object) { return $object; diff --git a/lib/private/ServerContainer.php b/lib/private/ServerContainer.php index c4f95b6488a6..d685ade98380 100644 --- a/lib/private/ServerContainer.php +++ b/lib/private/ServerContainer.php @@ -73,7 +73,7 @@ public function query($name) { // In case the service starts with OCA\ we try to find the service in // the apps container first. - if (strpos($name, 'OCA\\') === 0 && substr_count($name, '\\') >= 2) { + if (strrpos($name, 'OCA\\', -strlen($name)) !== false && substr_count($name, '\\') >= 2) { $segments = explode('\\', $name); $appContainer = $this->getAppContainer(strtolower($segments[1])); try {