PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Database » DB_DataObject » Bug #10132

Bad declaration

Details

Submitted2007-02-20 14:44 UTC
Fromandrzej dot wojdas at onet dot eu
StatusBogus
PackageDB_DataObject
PHP Version4.3.9
OSWINXP
Roadmaps(Not assigned)

Comments

[2007-02-20 14:44 UTC] andrzej dot wojdas at onet dot eu

Description:
------------
There's a bugs (I thing so).

line: 411
Before: $this->_build_condition($this->table()) ;

After my change: $this->_build_condition($this->keys()) ;

Function declaration:

function _build_condition($keys, $filter = array(),$negative_filter=array())

First parameter is $this->keys() but not $this->table();

Test script:
---------------
class mytable extends DB_DataObject {
var $_database_dsn = "mysql://root:test@127.0.0.1/test";
var $__table;

function keys() {
return array('uid');
}
}

$instance = new mytable;
$instance->DebugLevel(5);
$instance->table('test');
$instance->find();

while ($instance->fetch()) {
echo "\n".$instance->kl_uid;
}

Expected result:
----------------
Table "test" rows

Actual result:
--------------
Warning: Invalid argument supplied for foreach() in DataObject.php on line 2427