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

Bug #6693 Trouble with mysql_free_result -> "not a valid MySQL result resource"
Submitted: 2006-02-04 17:38 UTC
From: mikko dot pori at ncc dot fi Assigned:
Status: Wont fix Package: DB (version 1.7.6)
PHP Version: 5.1.2 OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [2006-02-04 17:38 UTC] mikko dot pori at ncc dot fi
Description: ------------ Making the following qeury: $tulos2=$db->getOne("SELECT tila_id FROM Lomake_tila WHERE tila_id='$rivi[id]' AND lomake_id='$lomake'"); (kohde.php, line 99) causes the following error to appear when there is no result from the qeury(0 lines). When the query has something to bring back, all works normally. Also, changing the connectiontype to autofree=>false instead of true makes the error disappear: $options = array('debug'=>2,'autofree'=>false); Expected result: ---------------- No errors ;) When you have no results, thats what you should get. Actual result: -------------- PHP Error [2] [mysql_free_result(): supplied argument is not a valid MySQL result resource] at line 422 in /usr/share/php/DB/mysql.php. (mysql.php:422),(DB.php:1285),(common.php:1243),(kohde.php:99)

Comments

 [2006-04-20 17:50 UTC] sn_ at gmx dot net (David S.)
I'm not a developer of DB but i tried to reproduce the bug. I was not able to reproduce it with any error reporting levels and so on. On my DB 1.7.6 installed by using pear install, DB prevent error output by adding @ befor mysql_free. So line 422 looks like: function freeResult ($result) { return @mysql_free_result($result); } So there should be no error. Well i didn't get an error.
 [2006-04-20 17:53 UTC] lsmith (Lukas Smith)
I presume he has a custom error handler that does not handle silenced calls properly. It might not be nice that it calls the function if its not needed. But I dont think we will add any logic to handle this now.