Library globals

KjwLib global functions. More...


Functions

 kjw_error_handler ($errno, $errstr, $errfile, $errline, $errcontext)
 The KjwLib error handler.
 kjw_trace ($msg, $level= 'DEBUG', $namespace= '(global)')
 Print a message to the resource pointed to by KJW_STDLOG.
 kjw_croak ($namespace, $shortMsg, $detailedMsg, $backtraceShift=0)
 Report an error and die.

Variables

 $kjw_suppressed_error = null
 Stores a suppressed error.


Detailed Description

KjwLib global functions.

Function Documentation

kjw_croak ( namespace,
shortMsg,
detailedMsg,
backtraceShift = 0 
)

Report an error and die.

This function checks php_sapi_name() to see if we're running CLI or non-CLI (CGI) mode. In non-CLI mode we add HTML to the error message for extra readability.

The KJW_EMAIL_ERRORS_TO decides whether we should print the detailed message as well or print only the short one and send the detailed message by email. A call to trace()/kjw_trace() is also made.

Parameters:
$namespace The class/namespace where the croaking was initiated.
$shortMsg An accompanying message which contains no information an attacker might use.
$detailedMsg An accompanying message with all the details.
$backtraceShift How many functions we should pop from the stack so we don't show the error handling itself.
Returns:
This function does *not* return.

Definition at line 147 of file KjwLib.php.

References $kjw_suppressed_error, and kjw_trace().

Referenced by KjwObject::croak(), and kjw_error_handler().

kjw_error_handler ( errno,
errstr,
errfile,
errline,
errcontext 
)

The KjwLib error handler.

This handles all PHP errors which are trapped by the `error_reporting` ini variable. All non-suppressed errors get sent to kjw_croak(). If you suppress the error, the error message is stored in the $kjw_suppressed_error global.

Parameters:
$errno An error number.
$errstr An error message.
$errfile The full path of the file in which the error occurred.
$errline The line in the file where the error occurred.
$errcontext The variables local to where the error occurred.
Note:
You do not call this. PHP calls this.

Definition at line 93 of file KjwLib.php.

References $kjw_suppressed_error, and kjw_croak().

kjw_trace ( msg,
level = 'DEBUG',
namespace = '(global)' 
)

Print a message to the resource pointed to by KJW_STDLOG.

If you want to debug SQL queries for example, fopen() a file in write mode and assign it to the KJW_STDLOG define. Some KjwLib functions and methods call this. It might be useful for profiling.

Parameters:
$msg The message to print.
$level The importance (DEBUG, INFO, NOTICE, WARNING, ERROR).
$namespace The tracing object name or context.

Definition at line 124 of file KjwLib.php.

Referenced by kjw_croak(), and KjwObject::trace().


Variable Documentation

$kjw_suppressed_error = null

Stores a suppressed error.

When you use the at-sign (@) to suppress an error, the error message is stored in this global. Normally, you do not need to suppress many errors. Think twice before using it.

Definition at line 77 of file KjwLib.php.

Referenced by KjwMsSql::connect(), KjwFakeSql::connect(), kjw_croak(), and kjw_error_handler().


Generated on Wed Apr 8 22:16:35 2009 for KjwLib-php45 by  doxygen 1.5.8