From 344c9682de06134faae31499fe38afb2df55903a Mon Sep 17 00:00:00 2001 From: Josh Richards Date: Thu, 27 Jun 2024 10:57:14 -0400 Subject: [PATCH] fix: switch from explode to substr (faster) Signed-off-by: Josh Richards --- lib/private/Config.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/private/Config.php b/lib/private/Config.php index fe97bd01217..aa20f627edc 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; } }