Connect to DB before getting attribute
Attempt to fix the "PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[IM001]: Driver does not support this function: driver does not support that attribute'" thrown on PHP 5.4. It could be that issuing PDO::getAttribute() before being connected to the DB prevents exception from being caught
This commit is contained in:
parent
8534e7d250
commit
c0c91a02d2
@ -78,6 +78,8 @@ class YDB extends ExtendedPdo {
|
||||
public function __construct($dsn, $user, $pass, $options, $attributes) {
|
||||
parent::__construct($dsn, $user, $pass, $options, $attributes);
|
||||
|
||||
$this->connect_to_DB();
|
||||
|
||||
// Log query infos
|
||||
$this->start_profiler();
|
||||
}
|
||||
|
@ -53,8 +53,7 @@ function yourls_db_connect() {
|
||||
$attributes = yourls_apply_filter( 'db_connect_attributes', array() ); // attributes as key-value pairs
|
||||
|
||||
$ydb = new \YOURLS\Database\YDB( $dsn, $user, $pass, $driver_options, $attributes );
|
||||
yourls_debug_log(sprintf('Connecting to database %s on %s ', $dbname, $dbhost));
|
||||
$ydb->connect_to_DB();
|
||||
yourls_debug_log(sprintf('Connected to database %s on %s ', $dbname, $dbhost));
|
||||
|
||||
yourls_debug_mode(YOURLS_DEBUG);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user