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.
This commit is contained in:
Dylan K. Taylor
2025-10-12 14:48:04 +01:00
parent a314d2dbb1
commit d0fca5e5d0

View File

@@ -215,10 +215,9 @@ final class CommandOverload{
if($offset === strlen($commandLine)){ if($offset === strlen($commandLine)){
//no more tokens, rest of the parameters must be optional //no more tokens, rest of the parameters must be optional
break; break;
}elseif(is_string($parameter)){
throw new ParameterParseException("Incorrect literal provided (should have been \"$parameter\" followed by whitespace)");
}else{ }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"); throw new ParameterParseException("Parameter " . get_class($parameter) . " for \$" . $parameter->getCodeName() . " didn't stop on a whitespace character");
} }
} }