-
Notifications
You must be signed in to change notification settings - Fork 69
Closed
Description
Hello
I have a bug in v 0.5.* and v0.6.*
While we have an invalid type of argument, we haven't drop current state of mysql, look at example, because exception does not catch
<?php
declare(strict_types=1);
require_once 'vendor/autoload.php';
$connection = $factory->createLazyConnection('root:[email protected]:3306/storage');
$connection->query("update table set value = ?", [new stdClass()]) // Invalid type of object
->otherwise(function ($e) use ($connection) {
return $connection->query("select * from table where id = 1")
->then(function ($e) {
echo 1; // thats never happened
})
->otherwise(function ($e) use ($connection) {
echo 1; // thats too
});
});
Look at this method:
Line 383 in c36b92f
protected function nextRequest($isHandshake = false) |
And its body (i do not know how to reply multiple lines of code, sorry, so paste my)
protected function nextRequest($isHandshake = false)
{
if (!$isHandshake && $this->phase != self::PHASE_HANDSHAKED) {
return false;
}
if ($this->currCommand === null && !$this->executor->isIdle()) {
$command = $this->executor->dequeue();
$this->currCommand = $command; // current command set here
if ($command instanceof AuthenticateCommand) {
$this->phase = self::PHASE_AUTH_SENT;
$this->sendPacket($command->authenticatePacket($this->scramble, $this->buffer));
} else {
$this->seq = 0;
$this->sendPacket($this->buffer->buildInt1($command->getId()) . $command->getSql()); // Exception occurs here
}
}
return true;
}
Exception line never catched and just reject:
Line 119 in 89067b2
throw new \InvalidArgumentException(sprintf('Not supportted value type of %s.', $type)); |
Line 72 in 89067b2
return \React\Promise\reject($e); |
So we are cannot send more queries from its connection, cause do not drop $this->currCommand