From 8eb48f9b50214bc04f322b6b5c31d21d82d129ac Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sat, 28 Oct 2023 19:55:57 +0200 Subject: [PATCH] Config::processLongArgument(): fix storing of unknown arguments These arguments should be stored in the `unknown` property. There is no `values` property. Note: the read/write logic is to prevent a `Indirect modification of overloaded property PHP_CodeSniffer\Config::$unknown has no effect` PHP notice. --- src/Config.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Config.php b/src/Config.php index 0320bdee87..0c09de71dc 100644 --- a/src/Config.php +++ b/src/Config.php @@ -1219,13 +1219,17 @@ public function processLongArgument($arg, $pos) if ($this->dieOnUnknownArg === false) { $eqPos = strpos($arg, '='); try { + $unknown = $this->unknown; + if ($eqPos === false) { - $this->values[$arg] = $arg; + $unknown[$arg] = $arg; } else { - $value = substr($arg, ($eqPos + 1)); - $arg = substr($arg, 0, $eqPos); - $this->values[$arg] = $value; + $value = substr($arg, ($eqPos + 1)); + $arg = substr($arg, 0, $eqPos); + $unknown[$arg] = $value; } + + $this->unknown = $unknown; } catch (RuntimeException $e) { // Value is not valid, so just ignore it. }