PHP “Fatal Error” Follow-up
Posted on July 26, 2006
Filed Under /dev/null/ | 230 views |
It should be mentioned that I consider PHP’s running out of memory in this case to be a bug and not a feature or expected behaviour. The inability to connect to a database should not result in the error I’m seeing but rather should result in the error being handled gracefully (esp. when you factor in the seg fault at higher memory values).
PHP’s mysql_select_db function returns a boolean indicating a result. ADODB uses this code:
function SelectDB($dbName)
{
$this->database = $dbName;
$this->databaseName = $dbName;
if ($this->_connectionID) {
return @mysql_select_db($dbName,$this->_connectionID);
}
else return false;
}
which also returns a boolean but that boolean never makes it back. Somewhere in there is a pretty serious memory issue and I’m guessing, from my inability to find any mention of any such bug anywhere else on the web, that it’s a pretty edge-case sort of issue. When I have the time I’ll reduce down to a simple level a reproducable case.