Paxton
Banned User
Hi There, so I wrote my own exception debugger, which helps me a bit with applications, and I came up with idea this could be very good for Gesior AAC because it has a lot of Fatal errors because of uncaught exceptions
So create new file in your aac folder called patch.php and paste this into it:
Now open your index.php and paste this line:
Somewhere at line: 10
Ok, so it really helps finding the error, and it doesn't show nasty fatal error so visitors can actually understand what's going on.
Here is the example of log received after uncaught exception.
Thanks.
So create new file in your aac folder called patch.php and paste this into it:
PHP:
<?php
#Paxton Patch 0.1 for uncaught exceptions.
#Set the exception handler to the right function so it will be fired when exception has not been caught,
set_exception_handler('catchException');
#The actual function
function catchException($exception) {
#Setting error style
echo "<style>body {background: black;color: white;font-family: system;}</style><center><h2>Fatal Error!</h2>";
echo "An unexpected error has occured! <br>At the bottom log has been generated please pass those information to the website administrator.";
echo "<br>Exception has been thrown but it has not been caught.<br><br><br>";
echo "<font color='silver'>";
echo "Exception information<br><br>";
echo "Message received: <i>".$exception->getMessage()."</i><br>";
echo "File: ".$exception->getFile()."<br>";
echo "On line: ".$exception->getLine()."<br>";
echo "Exception code: ".$exception->getCode()."<br><br>";
echo "Current site<br><br>";
echo "Error shown on: ".$_SERVER['SCRIPT_FILENAME']."<br><br>";
echo "Requests<br><br>";
foreach($_REQUEST as $key => $value){echo "$key :: $value <br>";}
echo "<br><br>";
echo "Last errors<br><br>";
foreach(error_get_last() as $key => $value){ echo "$key :: $value <br>";}
echo "</font>";
#Exit the application, mostly not needed but for future.
exit;
}
?>
Now open your index.php and paste this line:
PHP:
include("patch.php");
Somewhere at line: 10
Ok, so it really helps finding the error, and it doesn't show nasty fatal error so visitors can actually understand what's going on.
Here is the example of log received after uncaught exception.
Fatal Error!
An unexpected error has occured!
At the bottom log has been generated please pass those information to the website administrator.
Exception has been thrown but it has not been caught.
Exception information
Message received: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'acc.z_shop_offer' doesn't exist
File: C:\xampp\htdocs\acc\shopsystem.php
On line: 55
Exception code: 42S02
Current site
Error shown on: C:/xampp/htdocs/acc/index.php
Requests
subtopic :: shopsystem
PHPSESSID :: da2588888a8c607bcf120bdce429638f
Last errors
type :: 8
message :: Undefined variable: main_content
file :: C:\xampp\htdocs\acc\shopsystem.php
line :: 98
Thanks.