One of my DB servers went down momentarily and my production site started spewing out PDO SQL Exceptions with full stack trace including password. I have set the database options as:
$db = new Db\Adapter\Pdo\Mysql(array(
'username' => 'root',
'password' => 'hello',
'dbname' => 'test',
'options' => array(
PDO::ATTR_ERRMODE => PDO::ERRMODE_SILENT
)
));
I have also set the following which works fine for all other errors except PDO:
ini_set('display_errors', 0);
Despite this, when one of my DB servers went down momentarily, my production site started showing the full exception and password:
string(94) "SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known"
object(PDOException)#86 (8) {
["message":protected]=>
string(94) "SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known"
["string":"Exception":private]=>
string(0) ""
["code":protected]=>
int(2002)
["file":protected]=>
string(53) "/var/www/www.dawn.com/apps/shared/config/services.php"
["line":protected]=>
int(86)
["trace":"Exception":private]=>
array(11) {
[0]=>
array(4) {
["function"]=>
string(11) "__construct"
["class"]=>
string(3) "PDO"
["type"]=>
string(2) "->"
["args"]=>
array(4) {
[0]=>
...
[1]=>
array(4) {
["function"]=>
string(7) "connect"
["class"]=>
string(22) "Phalcon\Db\Adapter\Pdo"
["type"]=>
string(2) "->"
Am I missing something or is this a Phalcon bug? All suggestions welcome.