]> git.mxchange.org Git - lfdb2.git/commitdiff
WIP: master
authorRoland Häder <roland@mxchange.org>
Thu, 17 Aug 2023 00:39:51 +0000 (02:39 +0200)
committerRoland Häder <roland@mxchange.org>
Mon, 15 Jan 2024 21:38:41 +0000 (22:38 +0100)
- removed deprecated files
- updated exceptions.php
- updated 'core' framework

application/lfdb2/data.php [deleted file]
application/lfdb2/exceptions.php
application/lfdb2/init.php [deleted file]
application/lfdb2/loader.php [deleted file]
application/lfdb2/starter.php [deleted file]
core

diff --git a/application/lfdb2/data.php b/application/lfdb2/data.php
deleted file mode 100644 (file)
index 7d6dcee..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-<?php
-// @DEPRECATED
index e84a25e6248c3125845095b3ce5059622cdefaab..3f042647bdaf4f3e79b003769a5b614836277de1 100644 (file)
@@ -10,7 +10,7 @@ use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
  *
  * @author             Roland Haeder <webmaster@shipsimu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2022 LFDB2 Developer Team
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2023 Hub Developer Team
  * @license            GNU GPL 3.0 or any newer version
  *
  * This program is free software: you can redistribute it and/or modify
@@ -34,16 +34,22 @@ function lfdb2_exception_handler ($exceptionInstance) {
                // Init variable
                $backTrace = '';
 
+               // Generate exception code
+               $exceptionCode = ($exceptionInstance instanceof FrameworkException ? $exceptionInstance->getHexCode() : '0x' . bin2hex($exceptionInstance->getCode()));
+
                // Get all call levels from backtrace
                foreach ($exceptionInstance->getTrace() as $idx => $traceArray) {
                        // Init argument string
                        $argsString = '';
 
-                       // Convert arguments type into human-readable
-                       foreach ($traceArray['args'] as $arg) {
-                               $argsString .= ', ' . gettype($arg);
+                       // Arguments given?
+                       if (isset($traceArray['args'])) {
+                               // Convert arguments type into human-readable
+                               foreach ($traceArray['args'] as $arg) {
+                                       $argsString .= ', ' . gettype($arg);
+                               }
+                               $argsString = substr($argsString, 2);
                        }
-                       $argsString = substr($argsString, 2);
 
                        // Set missing file/line
                        if (!isset($traceArray['file']))  $traceArray['file']  = 'unknown';
@@ -81,7 +87,7 @@ Backtrace:
 --------------------------------------------------------------------------------\n",
                        trim(html_entity_decode(strip_tags(get_class($exceptionInstance)))),
                        trim(html_entity_decode(strip_tags($exceptionInstance->getMessage()))),
-                       ($exceptionInstance instanceof FrameworkException ? $exceptionInstance->getHexCode() : '0x' . bin2hex($exceptionInstance->getCode())),
+                       $exceptionCode,
                        $exceptionInstance->getFile(),
                        $exceptionInstance->getLine(),
                        trim($backTrace)
@@ -89,23 +95,28 @@ Backtrace:
 
                // Output the message
                print($message);
+
+               // Exit with code
+               exit(hexdec($exceptionCode));
        } elseif (is_object($exceptionInstance)) {
                // Output more details
                printf('exceptionInstance=%s', print_r($exceptionInstance, true));
+               exit(255);
        } else {
                /*
                 * Invalid exception instance detected! Do *only* throw exceptions that
                 * extends our own exception 'FrameworkException' to get such nice
                 * outputs like above.
                 */
-               printf('exceptionInstance[]=%s is invalid! Please inform the core developer team.' . PHP_EOL, gettype($exceptionInstance));
+               printf('exceptionInstance[]=%s is invalid! Please inform the LFDB2 developer team.' . PHP_EOL, gettype($exceptionInstance));
+               exit(255);
        }
 }
 
 // Error handler
-function lfdb2_error_handler ($errno, $errstr, $errfile, $errline, array $errcontext) {
+function lfdb2_error_handler (int $errno, string $errstr, string $errfile, int $errline, array $errcontext) {
        // Construct the message
-       $message = sprintf('File: %s, Line: %s, Code: %s, Message: %s',
+       $message = sprintf('File: %s, Line: %d, Code: %d, Message: %s',
                basename($errfile),
                $errline,
                $errno,
@@ -117,9 +128,9 @@ function lfdb2_error_handler ($errno, $errstr, $errfile, $errline, array $errcon
 }
 
 // Assertion handler
-function lfdb2_assert_handler (string $file, int $line, $code) {
+function lfdb2_assert_handler (string $file, int $line, int $code) {
        // Empty code?
-       if ($code === '') {
+       if (empty($code)) {
                $code = '<em>Unknown</em>';
        }
 
@@ -145,7 +156,7 @@ set_exception_handler('lfdb2_exception_handler');
 
 // Init assert handling
 assert_options(ASSERT_ACTIVE    , true);
-assert_options(ASSERT_WARNING   , false);
+assert_options(ASSERT_WARNING   , true);
 assert_options(ASSERT_BAIL      , true);
 assert_options(ASSERT_QUIET_EVAL, false);
 assert_options(ASSERT_CALLBACK  , 'lfdb2_assert_handler');
diff --git a/application/lfdb2/init.php b/application/lfdb2/init.php
deleted file mode 100644 (file)
index 7d6dcee..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-<?php
-// @DEPRECATED
diff --git a/application/lfdb2/loader.php b/application/lfdb2/loader.php
deleted file mode 100644 (file)
index 7d6dcee..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-<?php
-// @DEPRECATED
diff --git a/application/lfdb2/starter.php b/application/lfdb2/starter.php
deleted file mode 100644 (file)
index 7d6dcee..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-<?php
-// @DEPRECATED
diff --git a/core b/core
index cef490aa082a79da16d3dd2b1951dd993c9eda08..6e12381ce34de3edb56d18830949362491ddb61a 160000 (submodule)
--- a/core
+++ b/core
@@ -1 +1 @@
-Subproject commit cef490aa082a79da16d3dd2b1951dd993c9eda08
+Subproject commit 6e12381ce34de3edb56d18830949362491ddb61a