diff --git a/Account/PermissionAbstract.php b/Account/PermissionAbstract.php index 09e9b4dec..06ecd6e87 100644 --- a/Account/PermissionAbstract.php +++ b/Account/PermissionAbstract.php @@ -25,7 +25,7 @@ namespace phpOMS\Account; * @link http://website.orange-management.de * @since 1.0.0 */ -class PermissionAbstract +class PermissionAbstract implements \JsonSerializable { /** * Permission id. @@ -54,7 +54,7 @@ class PermissionAbstract /** * Module id. * - * @var int|null + * @var string|null * @since 1.0.0 */ protected $module = null; @@ -166,11 +166,11 @@ class PermissionAbstract /** * Get module id. * - * @return int|null + * @return string|null * * @since 1.0.0 */ - public function getModule() : ?int + public function getModule() : ?string { return $this->module; } @@ -178,13 +178,13 @@ class PermissionAbstract /** * Set module id. * - * @param int $module Module + * @param string $module Module * * @return void * * @since 1.0.0 */ - public function setModule(int $module = null) : void + public function setModule(string $module = null) : void { $this->module = $module; } @@ -346,4 +346,22 @@ class PermissionAbstract { return ($this->permission | $permission) === $this->permission; } + + /** + * {@inheritdoc} + */ + public function jsonSerialize() + { + return [ + 'id' => $this->id, + 'unit' => $this->unit, + 'app' => $this->app, + 'module' => $this->module, + 'from' => $this->from, + 'type' => $this->type, + 'element' => $this->element, + 'component' => $this->component, + 'permission' => $this->permission, + ]; + } } diff --git a/UnhandledHandler.php b/UnhandledHandler.php index a293ba38b..91dfb1682 100644 --- a/UnhandledHandler.php +++ b/UnhandledHandler.php @@ -62,26 +62,19 @@ final class UnhandledHandler $logger = FileLogger::getInstance(__DIR__ . '/../Logs'); if (!(\error_reporting() & $errno)) { - $logger->error(FileLogger::MSG_FULL, [ - 'message' => 'Undefined error', - 'line' => $errline, - 'file' => $errfile, - ]); - \error_clear_last(); return false; } + \error_clear_last(); $logger->error(FileLogger::MSG_FULL, [ - 'message' => 'Unhandled error', + 'message' => 'Undefined error', 'line' => $errline, 'file' => $errfile, ]); - \error_clear_last(); - return true; } @@ -96,6 +89,7 @@ final class UnhandledHandler public static function shutdownHandler() : void { $e = \error_get_last(); + \error_clear_last(); if ($e !== null) { $logger = FileLogger::getInstance(__DIR__ . '/../Logs');