Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.1.2

Bug #14862 Fatal error: Call to undefined method DB_Error::tableinfo()
Submitted: 2008-10-25 05:47 UTC
From: doconnor Assigned: quipo
Status: Closed Package: DB_QueryTool (version 1.1.2)
PHP Version: 5.2.4 OS:
Roadmaps: (Not assigned)    

 [2008-10-25 05:47 UTC] doconnor (Daniel O'Connor)
Description: ------------ When you use the DB_QueryTool with a DSN that doesn't exist, it causes fatal errors by not checking if it has an error or not. Found via #14850 This sounds exactly like Bug #520 Actual result: -------------- Fatal error: Call to undefined method DB_Error::tableinfo() in /usr/share/php/DB/QueryTool/Query.php on line 1837 Call Stack: 0.0010 62108 1. {main}() /home/clockwerx/foo.php:0 0.1632 1527004 2. DB_QueryTool_Query->getQueryString() /home/clockwerx/foo.php:10 0.1632 1527004 3. DB_QueryTool_Query->_buildSelectQuery() /usr/share/php/DB/QueryTool/Query.php:597 0.1633 1527060 4. DB_QueryTool_Query->_buildOrder() /usr/share/php/DB/QueryTool/Query.php:2323 0.1633 1527060 5. DB_QueryTool_Query->_prependTableName() /usr/share/php/DB/QueryTool/Query.php:2259 0.1633 1527060 6. DB_QueryTool_Query->metadata() /usr/share/php/DB/QueryTool/Query.php:1874


 [2008-10-25 05:49 UTC] doconnor (Daniel O'Connor)
Reproduce script <?php require_once 'DB/QueryTool.php'; $dsn = 'mysql://user:pass@server/db'; $Query = new DB_QueryTool_Query($dsn); $Query->setTable('users'); $Query->setSelect('user_id'); $Query->addSelect('username'); $Query->setOrder('user_id', true); $Query->setLimit(0,1); $sql = $Query->getQueryString(); echo $sql, "\n";
 [2008-10-25 05:49 UTC] doconnor (Daniel O'Connor)
 [2008-10-25 06:00 UTC] doconnor (Daniel O'Connor)
Ah hah! if (!is_object($this->db)) { return false; } should be if (!is_object($this->db)) { return false; } if (PEAR::isError($this->db)) { return false; } However, this appears to be a widespread problem throught the package
 [2008-10-25 06:18 UTC] doconnor (Daniel O'Connor)
 [2008-11-09 19:10 UTC] quipo (Lorenzo Alberton)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on by the end of next Sunday (CET). If this was a problem with the website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.