Skip to content

Commit

Permalink
Merge branch 'master' into add-column-factory
Browse files Browse the repository at this point in the history
  • Loading branch information
vjik authored Aug 31, 2024
2 parents 33a22cc + 2f82ef6 commit 1e4a792
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
- Enh #865: Raise minimum PHP version to `^8.1` with minor refactoring (@Tigrov, @vjik)
- Enh #798: Allow `QueryInterface::one()` and `QueryInterface::all()` to return objects (@darkdef, @Tigrov)
- Enh #864: Realize column factory (@Tigrov)
- Enh #875: Ignore "Packets out of order..." warnings in `AbstractPdoCommand::internalExecute()` method (@Tigrov)

## 1.3.0 March 21, 2024

Expand Down
16 changes: 15 additions & 1 deletion src/Driver/Pdo/AbstractPdoCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
use Yiisoft\Db\Query\Data\DataReader;
use Yiisoft\Db\QueryBuilder\QueryBuilderInterface;

use function restore_error_handler;
use function set_error_handler;
use function str_starts_with;

/**
* Represents a database command that can be executed using a PDO (PHP Data Object) database connection.
*
Expand Down Expand Up @@ -204,7 +208,17 @@ protected function internalExecute(): void
$this->isolationLevel
);
} else {
$this->pdoStatement?->execute();
set_error_handler(
static fn(int $errorNumber, string $errorString): bool =>
str_starts_with($errorString, 'Packets out of order. Expected '),
E_WARNING,
);

try {
$this->pdoStatement?->execute();
} finally {
restore_error_handler();
}
}
break;
} catch (PDOException $e) {
Expand Down

0 comments on commit 1e4a792

Please sign in to comment.