From a2b77b5a93c6fa37ff26d3e0585e9c86a8f145d7 Mon Sep 17 00:00:00 2001 From: Bill Ross Date: Fri, 16 May 2025 14:50:33 -0600 Subject: [PATCH] May 16 edits --- _debug.php | 38 ++++++++++++++++++++++++++++++++++++ index.php | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100644 _debug.php create mode 100644 index.php diff --git a/_debug.php b/_debug.php new file mode 100644 index 0000000..a810328 --- /dev/null +++ b/_debug.php @@ -0,0 +1,38 @@ + 1) print($msg . "\n"); +} +register_shutdown_function(function () { + $error = error_get_last(); + + if ($error !== null) { + // Log fatal error details + $type = $error['type']; + $message = $error['message']; + $file = $error['file']; + $line = $error['line']; + + echo "[SHUTDOWN] Fatal error: {$message} in {$file} on line {$line}\n"; + // Optional: log to file + // file_put_contents('/path/to/shutdown.log', "[SHUTDOWN] ...\n", FILE_APPEND); + } else { + if (DEBUG > 1) { + DEBUG && header('Content-Type: text/plain'); + # define('X','Well'); + DEBUG && print("Constants\n".print_r((get_defined_constants(true))['user']??'No Constants', true) . "\n"); + DEBUG && print("Functions\n".print_r((get_defined_functions(true))['user']??'No Functions', true) . "\n"); + DEBUG && print("Variables\n".print_r(array_diff_key(get_defined_vars(), array_flip(['_SERVER','_GET','_POST','_COOKIE', '_FILES'])), true) . "\n"); + DEBUG && print("Includes\n".print_r(get_included_files(), true) . "\n"); + } + echo "[SHUTDOWN] Script completed normally.\n"; + } +}); + diff --git a/index.php b/index.php new file mode 100644 index 0000000..c435c3d --- /dev/null +++ b/index.php @@ -0,0 +1,57 @@ +') comment if we want to wrap +# the headmatter in a comment. +# +# The headmatter is delimited by either '----' or '++++' as per +# Markdown/yaml standards. +# Technical note that '+' is a regex character so \+{3,} instead of ++++ +if (preg_match('/^()?(.*)/ms',$contents, $parts) === true) { + $var_dump($parts); +} +