I implemented a debug function which utilizes some messaging I’ve implemented. However, when I put the function call into my code, I get the above error message. The function is contained in an include file which is conditionally included as follows (ahead of all others):
if( !isset($Debug) )
$Debug = TRUE; // force for testing
if( $Debug ) {
include(“debug.php”);
} else if( !function_exists(‘dbg’) ) {
function dbg() { return; }
}
I’ve verified that $Debug is in fact TRUE and that the function_exists(‘dbg’) call is returning TRUE.
However, when contained in another include file (that follows the inclusion of debug.php) I get the above error. Snippet of the line referenced by the interpeter is:
dbg(sprintf(“cfgInfo: Level is %d, Top is %d, AppID=%d Ent=%d, Com=%d, Sit=%d, Usr=%d”, $level, $top,
$cfgID(‘cfgAppID’), $cfgID[‘cfgEntID’], $cfgID[‘cfgComID’], $cfgID[‘cfgSitID’], $cfgID[‘cfgUsrID’]), dbgCFGDATA );
‘dbgCFGDATA’ is defined in debug.php as define(‘dbgCFGDATA’, 0xf0000000);
The actual dbg() function from my debug.php is (you’ll have to trust me that the messaging does work correctly):
function dbg($s, $lev=dbgALL, $prop=”) {
global $Debug;
if( ! isset($Debug) || !($Debug & $lev) ) // not for this one
return;
addMessage($s, ‘debug’, $prop);
}
Pretty simple all the way around. Psuedo code description expected to be:
Main:
If $Debug is not set, set it to TRUE
if $Debug is TRUE then include debug.php
else create a function that does nothing so the code doesn’t break.
Include File:
call the dbg() function from the code.
I did a google search for the above error but it turned up the question once with no real answer supplied as to the cause (got into a pissing match about code style, etc.).
Anyone have any pointers that can help me out?
thanks,
tony