Home » Database » DB_DataObject » Bug #1548
count() fails if $countWhat param is used
Details
| Submitted | 2004-06-02 21:51 UTC |
|---|---|
| From | todd at groundspring dot org |
| Assigned | alan_k |
| Status | Closed |
| Package | DB_DataObject |
| PHP Version | 5.0.0RC2 (Release Candidate 2) |
| OS | Debian |
| 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