Home » Database » DB_DataObject » Bug #958
debugLevel return value
Details
| Submitted | 2004-03-06 13:49 UTC |
|---|---|
| From | maka3d at yahoo dot com dot br |
| Assigned | alan_k |
| Status | Closed |
| Package | DB_DataObject |
| PHP Version | 4.3.4 |
| OS | winXP |
| Roadmaps | (Not assigned) |
Comments
[2004-03-06 13:49 UTC] maka3d at yahoo dot com dot br
Description:
------------
debugLevel function documents at the coments that return is null, but it returns the the debug conf.
I think this function should work as all toggle function of php like error_reporting where it set's the value but return the last setting, so I could do this:
$lastLevel = DB_DATAOBJECT::debugLevel(5);
// do something
DB_DATAOBJECT::debugLevel($lastLevel); // return the last level.
a fix to this could be:
function debugLevel($v = null)
{
global $_DB_DATAOBJECT;
if (empty($_DB_DATAOBJECT['CONFIG'])) {
DB_DataObject::_loadConfig();
}
$level = @$_DB_DATAOBJECT['CONFIG']['debug'];
if ($v !== null) {
$_DB_DATAOBJECT['CONFIG']['debug'] = $v;
}
return $level;
}