Cake version Revision: 2573
Came across a relatively old code base yesterday because one of our sites suddenly weren't down without reason. The site was still functional and not under any high load, and it was apparent it was the CakePHP software at fault. Basically, the database connection was made, but any queries (which I knew should yield results) returned an empty array. It took me quite awhile to figure out what exactly was going on, but it came down to this method (in the mysql dbo file).
Code: Select all
/**
* Executes given SQL statement.
*
* @param string $sql SQL statement
* @return resource Result resource identifier
* @access protected
*/
function _execute ($sql)
{
return mysql_query($sql, $this->connection) or die(mysql_error());
}So to fix the bug, I had to assign the result of mysql_query() and return it's return seperately.
Code: Select all
function _execute ($sql)
{
$result = mysql_query($sql, $this->connection) or die(mysql_error());
return $result;
}