Skip to content

Commit

Permalink
Ignore "Packets out of order. Expected ..." Warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Tigrov committed Aug 29, 2024
1 parent 99d69c1 commit 29187eb
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 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,15 @@ protected function internalExecute(): void
$this->isolationLevel
);
} else {
$this->pdoStatement?->execute();
set_error_handler(static function (int $errorNumber, string $errorString): bool {
return str_starts_with($errorString, 'Packets out of order. Expected ');

Check warning on line 212 in src/Driver/Pdo/AbstractPdoCommand.php

View check run for this annotation

Codecov / codecov/patch

src/Driver/Pdo/AbstractPdoCommand.php#L212

Added line #L212 was not covered by tests
}, E_WARNING);

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

0 comments on commit 29187eb

Please sign in to comment.