Skip to content

Commit 34a9e48

Browse files
committed
fix: switch from explode to substr (faster)
Signed-off-by: Josh Richards <josh.t.richards@gmail.com>
1 parent 2ffff51 commit 34a9e48

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

lib/private/Config.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,10 @@ private function readData() {
228228
// grab any "NC_" environment variables
229229
$envRaw = getenv();
230230
// only save environment variables prefixed with "NC_" in the cache
231+
$envPrefixLen = strlen(self::ENV_PREFIX);
231232
foreach ($envRaw as $rawEnvKey => $rawEnvValue) {
232233
if (str_starts_with($rawEnvKey, self::ENV_PREFIX)) {
233-
$realKey = explode(self::ENV_PREFIX, $rawEnvKey)[1];
234+
$realKey = substr($rawEnvKey, $envPrefixLen);
234235
$this->envCache[$realKey] = $rawEnvValue;
235236
}
236237
}

0 commit comments

Comments
 (0)