|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-08-10 10:44 UTC] gildseth at start dot no
Description: ------------ I accidentally passed a DELETE query to DB::getAll, and DB fell over: Fatal error: Call to a member function on a non-object in /usr/local/lib/php/DB/common.php on line 1166 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 06 05:00:01 2025 UTC |
An example which triggers the bug: <?PHP define('DB_CONNECT_STR', 'mysql://username:password@hostname/database'); require_once('DB.php'); $pearDB = DB::connect(DB_CONNECT_STR); $pearDB->getAll('DELETE FROM test WHERE id=4'); /* CREATE TABLE test (id int(11) default NULL); INSERT INTO test VALUES(4); */ ?>getAll checks for pear Error, however most databases just return DB_OK for update/alter queries.. so that check in getAll is incorrect. I guess just adding if ($ret == DB_OK) { return DB_OK; } should fix it. (similar comment in the postgres explain bug)