Bug #19407
closedCalling of mysql_connect needs to check that mysql extension exists
0%
Description
In this class.t3lib_db.php, at line 898 is the following code:
function sql_pconnect($TYPO3_db_host, $TYPO3_db_username, $TYPO3_db_password) {
// mysql_error() is tied to an established connection
// if the connection fails we need a different method to get the error message
ini_set('track_errors', 1);
ini_set('html_errors', 0);
if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['no_pconnect']) {
$this->link = @mysql_connect($TYPO3_db_host, $TYPO3_db_username, $TYPO3_db_password);
} else {
$this->link = @mysql_pconnect($TYPO3_db_host, $TYPO3_db_username, $TYPO3_db_password);
}
However, this assumes that mysql is installed.
My installation has mysqli and PDO installed only. Therefore, the code above simply crashes, with an error 500. I would suggest adding an
if (!extension_loaded ('mysql')) {/* Report error */}
check just before using the first mysql_ call.
Furthermore, no error appears in the logs, because you have used the silencing operator. I would suggest doing an ini_set ('display_errors', 0); then removing the silencing operator, then an ini_restore. This way the problem will appear in the logs but not on the screen.
Supporting mysqli is a secondary issue also. But the above should at least help people diagnose what the problem is, rather than getting a blank screen and no log warning.
(issue imported from #M9470)