Unverified Commit 1faeb780 authored by Marco Pivetta's avatar Marco Pivetta Committed by GitHub

Merge pull request #2955 from morozov/issues/2954

[DBAL-2954] Removed error suppression in IBM DB2 Statement
parents a5326972 9ec35f7c
...@@ -172,7 +172,7 @@ class DB2Statement implements \IteratorAggregate, Statement ...@@ -172,7 +172,7 @@ class DB2Statement implements \IteratorAggregate, Statement
} }
} }
$retval = @db2_execute($this->_stmt, $params); $retval = db2_execute($this->_stmt, $params);
if ($retval === false) { if ($retval === false) {
throw new DB2Exception(db2_stmt_errormsg()); throw new DB2Exception(db2_stmt_errormsg());
......
<?php
declare(strict_types=1);
namespace Doctrine\Tests\DBAL\Functional\Driver\IBMDB2;
use Doctrine\DBAL\Driver\IBMDB2\DB2Driver;
use Doctrine\Tests\DbalFunctionalTestCase;
use PHPUnit\Framework\Error\Notice;
class DB2StatementTest extends DbalFunctionalTestCase
{
protected function setUp()
{
if ( ! extension_loaded('ibm_db2')) {
$this->markTestSkipped('ibm_db2 is not installed.');
}
parent::setUp();
if ( ! $this->_conn->getDriver() instanceof DB2Driver) {
$this->markTestSkipped('ibm_db2 only test.');
}
}
public function testExecutionErrorsAreNotSuppressed()
{
$stmt = $this->_conn->prepare('SELECT * FROM SYSIBM.SYSDUMMY1 WHERE \'foo\' = ?');
// unwrap the statement to prevent the wrapper from handling the PHPUnit-originated exception
$wrappedStmt = $stmt->getWrappedStatement();
$this->expectException(Notice::class);
$wrappedStmt->execute([[]]);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment