Well err, I don't know what I did wrong....
This code:
try {
$this->CONN = new \PDO('mysql:dbname='.PASTEAES_DBNAME.';host='.PASTEAES_SERVER, PASTEAES_USERNAME, PASTEAES_PASSWORD);
$this->CONN->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch(PDOException $e) {
$this->raiseError('Fatal MySQL error', $e->getMessage());
}
Reports this to me:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000] [1049] Unknown database 'pasteaes'' in /var/www/pasteaes/common/class.pasteaes.php on line 25
But, as you can see it is clearly in a try and catch block.
The class that this particular piece of code is in is namespaced, which is why I used "\PDO" instead of "PDO" on line two of the code I shared above.
And oh, yeah, I know that the DB doesn't exist, but I still don't want this happening in the future (not that it will). I want to handle errors properly :(
catch(\PDOException $e)
^
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With