Debug
class Debug
Supports debugging and core error handling.
Attaches custom methods to the default error handling hooks in PHP. Currently, two levels of error are supported:
- Notice
- Warning
- Error
Uncaught exceptions are currently passed to the debug reporter as standard PHP errors.
Errors handled by this class are passed along to {@link SS_Log}. For configuration information, see the {@link SS_Log} class documentation.
Config options
log_errors_to | String | ||
friendly_error_header | string | ||
friendly_error_httpcode | bool | Set to true to enable friendly errors to set a http response code corresponding to the error. | |
friendly_error_detail | string |
Methods
Show the contents of val in a debug-friendly way.
Returns the caller for a specific method
Close out the show dumper
Quick dump of a variable.
??
Show a debugging message
Send a debug message in an HTTP header. Only works if you are on Dev, and headers have not yet been sent.
Log to a standard text file output.
Load error handlers into environment.
No description
Handle a non-fatal warning error thrown by PHP interpreter.
Handle a fatal error, depending on the mode of the site (ie: Dev, Test, or Live).
Render a user-facing error page, using the default HTML error template rendered by {@link ErrorPage} if it exists. Doesn't use the standard {@link SS_HTTPResponse} class the keep dependencies minimal.
Create an instance of an appropriate DebugView object.
Render a developer facing error page, showing the stack trace and details of the code where the error occured.
Utility method to render a snippet of PHP source code, from selected file and highlighting the given line number.
Check if the user has permissions to run URL debug tools, else redirect them to log in.
Details
at line 64
static
show($val, $showHeader = true)
Show the contents of val in a debug-friendly way.
Debug::show() is intended to be equivalent to dprintr()
at line 90
static array
caller()
Returns the caller for a specific method
at line 106
static
endshow(mixed $val)
Close out the show dumper
at line 121
static
dump(mixed $val)
Quick dump of a variable.
at line 131
static unknown
text(unknown_type $val)
??
at line 169
static
message($message, $showHeader = true)
Show a debugging message
at line 195
static void
header(string $msg, string $prefix = null)
Send a debug message in an HTTP header. Only works if you are on Dev, and headers have not yet been sent.
at line 207
static
log($message)
Log to a standard text file output.
at line 224
static
loadErrorHandlers()
Load error handlers into environment.
Caution: The error levels default to E_ALL is the site is in dev-mode (set in main.php).
at line 229
static
noticeHandler($errno, $errstr, $errfile, $errline, $errcontext)
at line 261
static
warningHandler(unknown_type $errno, unknown_type $errstr, unknown_type $errfile, unknown_type $errline, unknown_type $errcontext)
Handle a non-fatal warning error thrown by PHP interpreter.
at line 295
static
fatalHandler(unknown_type $errno, unknown_type $errstr, unknown_type $errfile, unknown_type $errline, unknown_type $errcontext)
Handle a fatal error, depending on the mode of the site (ie: Dev, Test, or Live).
Runtime execution dies immediately once the error is generated.
at line 332
static string
friendlyError(int $statusCode = 500, string $friendlyErrorMessage = null, string $friendlyErrorDetail = null)
Render a user-facing error page, using the default HTML error template rendered by {@link ErrorPage} if it exists. Doesn't use the standard {@link SS_HTTPResponse} class the keep dependencies minimal.
at line 386
static DebugView
create_debug_view()
Create an instance of an appropriate DebugView object.
at line 403
static
showError($errno, $errstr, $errfile, $errline, $errcontext, $errtype)
Render a developer facing error page, showing the stack trace and details of the code where the error occured.
at line 453
static
showLines(string $errfile, int $errline)
Utility method to render a snippet of PHP source code, from selected file and highlighting the given line number.
at line 475
static
require_developer_login()
Check if the user has permissions to run URL debug tools, else redirect them to log in.