mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 12:18:46 +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 get_loaded_extensions;
|
||||||
use function implode;
|
use function implode;
|
||||||
use function is_dir;
|
use function is_dir;
|
||||||
|
use function is_int;
|
||||||
use function is_resource;
|
use function is_resource;
|
||||||
use function json_encode;
|
use function json_encode;
|
||||||
use function json_last_error_msg;
|
use function json_last_error_msg;
|
||||||
|
@ -28,6 +28,7 @@ use pocketmine\errorhandler\ErrorTypeToStringMap;
|
|||||||
use pocketmine\thread\Thread;
|
use pocketmine\thread\Thread;
|
||||||
use pocketmine\thread\Worker;
|
use pocketmine\thread\Worker;
|
||||||
use function get_class;
|
use function get_class;
|
||||||
|
use function is_int;
|
||||||
use function preg_replace;
|
use function preg_replace;
|
||||||
use function sprintf;
|
use function sprintf;
|
||||||
use function trim;
|
use function trim;
|
||||||
@ -159,11 +160,13 @@ class MainLogger extends \AttachableThreadedLogger implements \BufferedLogger{
|
|||||||
$errstr = preg_replace('/\s+/', ' ', trim($e->getMessage()));
|
$errstr = preg_replace('/\s+/', ' ', trim($e->getMessage()));
|
||||||
|
|
||||||
$errno = $e->getCode();
|
$errno = $e->getCode();
|
||||||
|
if(is_int($errno)){
|
||||||
try{
|
try{
|
||||||
$errno = ErrorTypeToStringMap::get($errno);
|
$errno = ErrorTypeToStringMap::get($errno);
|
||||||
}catch(\InvalidArgumentException $ex){
|
}catch(\InvalidArgumentException $ex){
|
||||||
//pass
|
//pass
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$errfile = Filesystem::cleanPath($e->getFile());
|
$errfile = Filesystem::cleanPath($e->getFile());
|
||||||
$errline = $e->getLine();
|
$errline = $e->getLine();
|
||||||
|
@ -205,11 +205,6 @@ parameters:
|
|||||||
count: 1
|
count: 1
|
||||||
path: ../../../src/utils/Internet.php
|
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\\.$#"
|
message: "#^Part \\$errno \\(mixed\\) of encapsed string cannot be cast to string\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user