|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2012-11-17 11:10 UTC] nucer at mail dot ru
Description:
------------
It looks like PDO::quote ignores PDO::setAttribute(PDO::ATTR_ERRMODE,
PDO::ERRMODE_EXCEPTION); always sending warning, not exception.
Test script:
---------------
$db = new PDO("mysql:dbname=mydb;host=127.0.0.1", "root", "" );
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$db->quote( array() );
Actual result:
--------------
Warning: PDO::quote() expects parameter 1 to be string, array given in
Z:\home\test\www\test\db.php on line 27
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 07:00:01 2025 UTC |
Same case with you. Script ----------------- $db = new PDO("mysql:dbname=mydb;host=127.0.0.1", "root", "" ); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT); Error Message ----------------- Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [1049] Unknown database 'mydb'' in D:\var\www\class\mysql.php:33 Stack trace: #0 D:\var\www\class\mysql.php(33): PDO->__construct('mysql:host=127....', 'root', 'root') #1 D:\var\www\class\mysql.php(20): mysql->connect() #2 D:\var\www\test.php(5): mysql->__construct() #3 {main} thrown in D:\var\www\class\mysql.php on line 33