From 34a9e48827b3a03da48699d32c6138c2c89c139f Mon Sep 17 00:00:00 2001 From: Josh Richards Date: Thu, 27 Jun 2024 10:57:14 -0400 Subject: fix: switch from explode to substr (faster) Signed-off-by: Josh Richards --- lib/private/Config.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/private/Config.php b/lib/private/Config.php index 7ff7312ddea..46c32d5f628 100644 --- a/lib/private/Config.php +++ b/lib/private/Config.php @@ -228,9 +228,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; } } -- cgit v1.2.3