]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix: switch from explode to substr (faster) backport/46140/stable28 48099/head
authorJosh Richards <josh.t.richards@gmail.com>
Thu, 27 Jun 2024 14:57:14 +0000 (10:57 -0400)
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>
Mon, 16 Sep 2024 14:56:12 +0000 (14:56 +0000)
Signed-off-by: Josh Richards <josh.t.richards@gmail.com>
lib/private/Config.php

index 301edcd8c115286e6294ca45cc0a3d263f083c90..d69a9837e75436a2b64fa0bceacdff973def482b 100644 (file)
@@ -259,9 +259,10 @@ class Config {
                // grab any "NC_" environment variables
                $envRaw = getenv();
                // only save environment variables prefixed with "NC_" in the cache
+               $envPrefixLen = strlen(self::ENV_PREFIX);
                foreach ($envRaw as $rawEnvKey => $rawEnvValue) {
                        if (str_starts_with($rawEnvKey, self::ENV_PREFIX)) {
-                               $realKey = explode(self::ENV_PREFIX, $rawEnvKey)[1];
+                               $realKey = substr($rawEnvKey, $envPrefixLen);
                                $this->envCache[$realKey] = $rawEnvValue;
                        }
                }