mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-06 11:57:10 +00:00
MainLogger: do not assume that exception codes are always integers
PDOException most notably breaks this rule. closes #4294
This commit is contained in:
parent
1d8f0033af
commit
b7ea10b905
@ -44,6 +44,7 @@ use function fwrite;
|
||||
use function get_loaded_extensions;
|
||||
use function implode;
|
||||
use function is_dir;
|
||||
use function is_int;
|
||||
use function is_resource;
|
||||
use function json_encode;
|
||||
use function json_last_error_msg;
|
||||
|
@ -28,6 +28,7 @@ use pocketmine\errorhandler\ErrorTypeToStringMap;
|
||||
use pocketmine\thread\Thread;
|
||||
use pocketmine\thread\Worker;
|
||||
use function get_class;
|
||||
use function is_int;
|
||||
use function preg_replace;
|
||||
use function sprintf;
|
||||
use function trim;
|
||||
@ -159,10 +160,12 @@ class MainLogger extends \AttachableThreadedLogger implements \BufferedLogger{
|
||||
$errstr = preg_replace('/\s+/', ' ', trim($e->getMessage()));
|
||||
|
||||
$errno = $e->getCode();
|
||||
try{
|
||||
$errno = ErrorTypeToStringMap::get($errno);
|
||||
}catch(\InvalidArgumentException $ex){
|
||||
//pass
|
||||
if(is_int($errno)){
|
||||
try{
|
||||
$errno = ErrorTypeToStringMap::get($errno);
|
||||
}catch(\InvalidArgumentException $ex){
|
||||
//pass
|
||||
}
|
||||
}
|
||||
|
||||
$errfile = Filesystem::cleanPath($e->getFile());
|
||||
|
@ -205,11 +205,6 @@ parameters:
|
||||
count: 1
|
||||
path: ../../../src/utils/Internet.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$errorType of static method pocketmine\\\\errorhandler\\\\ErrorTypeToStringMap\\:\\:get\\(\\) expects int, mixed given\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/utils/MainLogger.php
|
||||
|
||||
-
|
||||
message: "#^Part \\$errno \\(mixed\\) of encapsed string cannot be cast to string\\.$#"
|
||||
count: 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user