mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 12:18:46 +00:00
ConsoleReaderThread: strip control characters
this fixes a bug I encountered when accidentally pressing ctrl+a+d (which inserts a chr(1) character), because it made the server unable to find the command - but still reported an error containing what looked like a valid command (character isn't printable).
This commit is contained in:
parent
ede4157814
commit
4dc13ab3da
@ -114,7 +114,9 @@ final class ConsoleReaderThread extends Thread{
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$buffer[] = preg_replace("#\\x1b\\x5b([^\\x1b]*\\x7e|[\\x40-\\x50])#", "", trim($command));
|
$command = preg_replace("#\\x1b\\x5b([^\\x1b]*\\x7e|[\\x40-\\x50])#", "", trim($command)) ?? throw new AssumptionFailedError("This regex is assumed to be valid");
|
||||||
|
$command = preg_replace('/[[:cntrl:]]/', '', $command) ?? throw new AssumptionFailedError("This regex is assumed to be valid");
|
||||||
|
$buffer[] = $command;
|
||||||
if($notifier !== null){
|
if($notifier !== null){
|
||||||
$notifier->wakeupSleeper();
|
$notifier->wakeupSleeper();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user