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 #1548

count() fails if $countWhat param is used

Details

Submitted2004-06-02 21:51 UTC
Fromtodd at groundspring dot org
Assignedalan_k
StatusClosed
PackageDB_DataObject
PHP Version5.0.0RC2 (Release Candidate 2)
OSDebian
Roadmaps(Not assigned)

Comments

[2004-06-02 21:51 UTC] todd at groundspring dot org

Description:
------------
Error in count():
PHP Notice: Undefined variable: table in /usr/share/php5/DB/DataObject.php on line 1360

---
Line 1349 of DB_DataObject needs to be moved outside of the if (!is_string($countWhat)) condition.

If $countWhat is passed in, $table doesn't get set and the query will fail (which always uses the $table variable).

Reproduce code:
---------------
$cnt = $this->count("id");

Expected result:
----------------
1

Actual result:
--------------
0 and error