mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-16 19:59:11 +00:00
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:
@@ -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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user