PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » DB_DataObject » Bug #958

debugLevel return value

Details

Submitted2004-03-06 13:49 UTC
Frommaka3d at yahoo dot com dot br
Assignedalan_k
StatusClosed
PackageDB_DataObject
PHP Version4.3.4
OSwinXP
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;
}