From d0fca5e5d0f37bb80dfc0daec8f719eadedce157 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sun, 12 Oct 2025 14:48:04 +0100 Subject: [PATCH] Fixed bad assumption about literals and subsequent whitespace Since it only compares the exact literal bytes, it's possible to have trailing characters that don't match. For example, /timings ons would crash because the 'on' overload would match, but leave a trailing 's' behind. --- src/command/overload/CommandOverload.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/command/overload/CommandOverload.php b/src/command/overload/CommandOverload.php index 730864242..a279fd494 100644 --- a/src/command/overload/CommandOverload.php +++ b/src/command/overload/CommandOverload.php @@ -215,10 +215,9 @@ final class CommandOverload{ if($offset === strlen($commandLine)){ //no more tokens, rest of the parameters must be optional break; + }elseif(is_string($parameter)){ + throw new ParameterParseException("Incorrect literal provided (should have been \"$parameter\" followed by whitespace)"); }else{ - if(is_string($parameter)){ - throw new AssumptionFailedError(); - } throw new ParameterParseException("Parameter " . get_class($parameter) . " for \$" . $parameter->getCodeName() . " didn't stop on a whitespace character"); } }