Weedpacket;11011561 wrote: die("It's a password, not the Preamble to the Constitution!");
(Incidentally, [man]die[/man] is an extremely rude way to tell the user that they made a mistake.)
Hmm, I'd say "touché", except I was writing my code to tell the OP that he/she made a mistake. In which case, while I shouldn't want to be personally rude, I think PHP can afford to insult the code author a tad, if only to encourage better practices in the future. 😃
Besides, don't we still practice the lazy principle here? die("foo"); is so much easier than "echo 'foo'; \n exit;" ... or:
<?php
//set the error handler
set_error_handler('default_debug_error_handler');
//set up error handling.
function default_debug_error_handler($errno, $errstr, $errfile, $errline, $errcontext){
static $queue = array();
$data = array ('errno' => $errno,
'errstr' => $errstr,
'errfile' => $errfile,
'errline' => $errline,
'errcontext' => $errcontext);
//un-comment next line for easy way to display errors if addon error handling is not working
if (defined('MODULES_ENABLED')) {
if (count($queue)) {
//errors were previously queued up before modules were fully
//initialized. Push them through now that modules are initialized.
foreach ($queue as $key => $val) {
myModule::execUpdate('errorhandle',$val);
}
$queue = array(); // reset the queue.
}
myModule::execUpdate('errorhandle',$data);
} else {
$queue[] = $data; //queue it to be reported once all modules are loaded.
}
return true;
}
😉