ID: 48773 Updated by: fel...@php.net Reported By: saschagros at gmail dot com -Status: Open +Status: Closed Bug Type: PDO related Operating System: Linux PHP Version: 6CVS-2009-07-02 (snap) -Assigned To: +Assigned To: Felipe New Comment:
Fixed in SVN. Thanks. Previous Comments: ------------------------------------------------------------------------ [2009-07-02 13:10:03] saschagros at gmail dot com Description: ------------ I'm getting the following error when the ATTR_STATEMENT_CLASS option is set... Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: PDO::ATTR_STATEMENT_CLASS requires format array(classname, array(ctor_args)); the classname must be a string specifying an existing class' in ..../drupal7/includes/database/database.inc:338 The same configuration works for PHP 5.2 and 5.3 The reproduce code is the constructor of the DatabaseConnection class of Drupal 7, see also http://cvs.drupal.org/viewvc.py/drupal/drupal/includes/database/database.inc?revision=1.57&view=markup Reproduce code: --------------- function __construct($dsn, $username, $password, $driver_options = array()) { // Because the other methods don't seem to work right. $driver_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION; // Call PDO::__construct and PDO::setAttribute. parent::__construct($dsn, $username, $password, $driver_options); // Set a specific PDOStatement class if the driver requires that. if (!empty($this->statementClass)) { $this->setAttribute(PDO::ATTR_STATEMENT_CLASS, array($this->statementClass, array($this))); } } Expected result: ---------------- The connection can be established.... Actual result: -------------- Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: PDO::ATTR_STATEMENT_CLASS requires format array(classname, array(ctor_args)); the classname must be a string specifying an existing class' in ..../drupal7/includes/database/database.inc:338 Stack trace: #0 .../drupal7/includes/database/database.inc(338): PDO->setAttribute(13, Array) #1 .../drupal7/includes/database/mysql/database.inc(36): DatabaseConnection->__construct('mysql:host=loca...', 'd7', 'd7', Array) #2 /.../drupal7/includes/database/database.inc(1350): DatabaseConnection_mysql->__construct(Array) #3 .../drupal7/includes/database/database.inc(1218): Database::openConnection('default', 'default') #4 .../drupal7/includes/database/database.inc(1793): Database::getConnection('default') #5 .../drupal7/includes/bootstrap.inc(1242): db_query('SELECT 1 FROM {...', Array) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=48773&edit=1