Skip to content

Commit

Permalink
Merge pull request #206 from weierophinney/fix/exception-arguments
Browse files Browse the repository at this point in the history
Ensure `null` is never used as an exception code
  • Loading branch information
Ocramius authored Sep 16, 2021
2 parents a7acfdb + a3c2b79 commit 7710d3c
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Adapter/Adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ protected function createDriver($parameters)
}

if (! isset($driver) || ! $driver instanceof Driver\DriverInterface) {
throw new Exception\InvalidArgumentException('DriverInterface expected', null, null);
throw new Exception\InvalidArgumentException('DriverInterface expected');
}

return $driver;
Expand Down
2 changes: 1 addition & 1 deletion src/Adapter/Driver/Mysqli/Statement.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public function prepare($sql = null)
if (! $this->resource instanceof mysqli_stmt) {
throw new Exception\InvalidQueryException(
'Statement couldn\'t be produced with sql: ' . $sql,
null,
$this->mysqli->errno,
new Exception\ErrorException($this->mysqli->error, $this->mysqli->errno)
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Adapter/Driver/Oci8/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public function connect()
$e = oci_error();
throw new Exception\RuntimeException(
'Connection error',
null,
$e['code'],
new Exception\ErrorException($e['message'], $e['code'])
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Adapter/Driver/Oci8/Statement.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public function prepare($sql = null)
$e = oci_error($this->oci8);
throw new Exception\InvalidQueryException(
'Statement couldn\'t be produced with sql: ' . $sql,
null,
$e['code'],
new Exception\ErrorException($e['message'], $e['code'])
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Adapter/Driver/Sqlsrv/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public function connect()
if (! $this->resource) {
throw new Exception\RuntimeException(
'Connect Error',
null,
0,
new ErrorException(sqlsrv_errors())
);
}
Expand Down

0 comments on commit 7710d3c

Please sign in to comment.