]> source.dussan.org Git - nextcloud-server.git/commitdiff
Move to str_starts_with
authorJulius Härtl <jus@bitgrid.net>
Mon, 21 Nov 2022 10:40:34 +0000 (11:40 +0100)
committerJulius Härtl <jus@bitgrid.net>
Wed, 7 Dec 2022 21:32:06 +0000 (22:32 +0100)
Signed-off-by: Julius Härtl <jus@bitgrid.net>
lib/private/AppFramework/DependencyInjection/DIContainer.php
lib/private/ServerContainer.php

index 8fe17d5a85e1b69a4722300440675a98910480c8..462f9b978fd91c213b6995cf282694eb8be20eb8 100644 (file)
@@ -472,11 +472,11 @@ class DIContainer extends SimpleContainer implements IAppContainer {
 
                if ($this->offsetExists($name)) {
                        return parent::query($name);
-               } elseif ($this->appName === 'settings' && strpos($name, 'OC\\Settings\\') === 0) {
+               } elseif ($this->appName === 'settings' && str_starts_with($name, 'OC\\Settings\\')) {
                        return parent::query($name);
-               } elseif ($this->appName === 'core' && strpos($name, 'OC\\Core\\') === 0) {
+               } elseif ($this->appName === 'core' && str_starts_with($name, 'OC\\Core\\')) {
                        return parent::query($name);
-               } elseif (strpos($name, \OC\AppFramework\App::buildAppNamespace($this->appName) . '\\') === 0) {
+               } elseif (str_starts_with($name, \OC\AppFramework\App::buildAppNamespace($this->appName) . '\\')) {
                        return parent::query($name);
                }
 
index 4352d0e835026d5293141e9f1bafab83bcfd11d8..e53737990e82f2f01588f25f8dbea997102f94f1 100644 (file)
@@ -139,7 +139,7 @@ class ServerContainer extends SimpleContainer {
        public function query(string $name, bool $autoload = true) {
                $name = $this->sanitizeName($name);
 
-               if (strpos($name, 'OCA\\') !== 0) {
+               if (str_starts_with($name, 'OCA\\')) {
                        // Skip server container query for app namespace classes
                        try {
                                return parent::query($name, false);