diff --git a/src/Dibi/Drivers/MySqliDriver.php b/src/Dibi/Drivers/MySqliDriver.php index 0b7c6826..5ee7c27b 100644 --- a/src/Dibi/Drivers/MySqliDriver.php +++ b/src/Dibi/Drivers/MySqliDriver.php @@ -106,7 +106,7 @@ class MySqliDriver implements Dibi\Driver, Dibi\ResultDriver } } } - @mysqli_real_connect($this->connection, (empty($config['persistent']) ? '' : 'p:') . $config['host'], $config['username'], $config['password'], $config['database'], $config['port'], $config['socket'], $config['flags']); // intentionally @ + @mysqli_real_connect($this->connection, (empty($config['persistent']) ? '' : 'p:') . $config['host'], $config['username'], $config['password'], $config['database'] ?? '', $config['port'] ?? 0, $config['socket'], $config['flags'] ?? 0); // intentionally @ if ($errno = mysqli_connect_errno()) { throw new Dibi\DriverException(mysqli_connect_error(), $errno); diff --git a/src/Dibi/Drivers/OdbcDriver.php b/src/Dibi/Drivers/OdbcDriver.php index facb98e2..65ca0c01 100644 --- a/src/Dibi/Drivers/OdbcDriver.php +++ b/src/Dibi/Drivers/OdbcDriver.php @@ -69,9 +69,9 @@ class OdbcDriver implements Dibi\Driver, Dibi\ResultDriver, Dibi\Reflector ]; if (empty($config['persistent'])) { - $this->connection = @odbc_connect($config['dsn'], $config['username'], $config['password']); // intentionally @ + $this->connection = @odbc_connect($config['dsn'], $config['username'] ?? '', $config['password'] ?? ''); // intentionally @ } else { - $this->connection = @odbc_pconnect($config['dsn'], $config['username'], $config['password']); // intentionally @ + $this->connection = @odbc_pconnect($config['dsn'], $config['username'] ?? '', $config['password'] ?? ''); // intentionally @ } } @@ -134,7 +134,7 @@ class OdbcDriver implements Dibi\Driver, Dibi\ResultDriver, Dibi\Reflector */ public function begin(string $savepoint = NULL): void { - if (!odbc_autocommit($this->connection, FALSE)) { + if (!odbc_autocommit($this->connection, 0/*FALSE*/)) { throw new Dibi\DriverException(odbc_errormsg($this->connection) . ' ' . odbc_error($this->connection)); } } @@ -149,7 +149,7 @@ class OdbcDriver implements Dibi\Driver, Dibi\ResultDriver, Dibi\Reflector if (!odbc_commit($this->connection)) { throw new Dibi\DriverException(odbc_errormsg($this->connection) . ' ' . odbc_error($this->connection)); } - odbc_autocommit($this->connection, TRUE); + odbc_autocommit($this->connection, 1/*TRUE*/); } @@ -162,7 +162,7 @@ class OdbcDriver implements Dibi\Driver, Dibi\ResultDriver, Dibi\Reflector if (!odbc_rollback($this->connection)) { throw new Dibi\DriverException(odbc_errormsg($this->connection) . ' ' . odbc_error($this->connection)); } - odbc_autocommit($this->connection, TRUE); + odbc_autocommit($this->connection, 1/*TRUE*/); } diff --git a/src/Dibi/Drivers/PdoDriver.php b/src/Dibi/Drivers/PdoDriver.php index d1f2c5d7..b11f1fe6 100644 --- a/src/Dibi/Drivers/PdoDriver.php +++ b/src/Dibi/Drivers/PdoDriver.php @@ -80,8 +80,7 @@ class PdoDriver implements Dibi\Driver, Dibi\ResultDriver } $this->driverName = $this->connection->getAttribute(PDO::ATTR_DRIVER_NAME); - $this->serverVersion = $config['version'] - ?? @$this->connection->getAttribute(PDO::ATTR_SERVER_VERSION); // @ - may be not supported + $this->serverVersion = (string) ($config['version'] ?? @$this->connection->getAttribute(PDO::ATTR_SERVER_VERSION)); // @ - may be not supported } diff --git a/src/Dibi/Drivers/SqlsrvDriver.php b/src/Dibi/Drivers/SqlsrvDriver.php index bb795c48..1c292bca 100644 --- a/src/Dibi/Drivers/SqlsrvDriver.php +++ b/src/Dibi/Drivers/SqlsrvDriver.php @@ -137,7 +137,7 @@ class SqlsrvDriver implements Dibi\Driver, Dibi\ResultDriver $res = sqlsrv_query($this->connection, 'SELECT SCOPE_IDENTITY()'); if (is_resource($res)) { $row = sqlsrv_fetch_array($res, SQLSRV_FETCH_NUMERIC); - return $row[0]; + return (int) $row[0]; } return NULL; } diff --git a/tests/dibi/bootstrap.php b/tests/dibi/bootstrap.php index 9f7217af..254b884f 100644 --- a/tests/dibi/bootstrap.php +++ b/tests/dibi/bootstrap.php @@ -70,7 +70,7 @@ function reformat($s) function num($n) { global $config; - if (substr(@$config['dsn'], 0, 5) === 'odbc:' || $config['driver'] === 'sqlite') { + if (substr($config['dsn'] ?? '', 0, 5) === 'odbc:' || $config['driver'] === 'sqlite') { $n = is_float($n) ? "$n.0" : (string) $n; } return $n;