-
Notifications
You must be signed in to change notification settings - Fork 44
Open
Description
Describe the bug
Only on Windows, the libasynql::create
function crashes with the following config
type: "sqlite"
sqlite:
file: "a" #NOTICE: `file` is a single character
with this error
ErrorException: "Uninitialized string offset 1" (EXCEPTION) in "C:/<pocketmine-dir>/virions/libasynql_dev-174.phar/src/poggit/libasynql/libasynql" at line 162
libasynql.php The comment marks the ErrorException.
private static function resolvePath(string $folder, string $path) : string{
if($path[0] === "/"){
return $path;
}
if(Utils::getOS() === "win"){
if($path[0] === "\\" || $path[1] === ":"){
// ErrorException thrown Above! ^^^^^^^
return $path;
}
}
return $folder . $path;
}
Another Bug
Furthermore, having file: ""
throws an error on all platforms, but that config is invalid anyways. It's arguable if that should be fixed too.
Expected behavior
This should not crash.
Environment
OS: "win"
PocketMine version: "4.2.0"
Metadata
Metadata
Assignees
Labels
No labels