Skip to content

Commit

Permalink
detect server gone away in failed statement too
Browse files Browse the repository at this point in the history
  • Loading branch information
ofbeaton committed Aug 5, 2016
1 parent 4a36abd commit c17d9a2
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/Command/PingCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,12 +270,19 @@ protected function ping(InputInterface $input, OutputInterface $output)
error_reporting($errorLevel);

if ($this->checkStmt === false) {
$this->writeReply(
'check failed statement: ['.$this->dbh->errorCode().'] '
.implode(' ', $this->dbh->errorInfo()),
$input,
$output
);
$errorInfo = $this->dbh->errorInfo();
// server has gone away
if (isset($errorInfo[1]) === true && $errorInfo[1] === 2006) {
$this->connected = false;
$this->writeReply('connection lost', $input, $output);
} else {
$this->writeReply(
'check failed statement: [' . $this->dbh->errorCode() . '] '
. implode(' ', $errorInfo),
$input,
$output
);
}
return false;
}

Expand Down

0 comments on commit c17d9a2

Please sign in to comment.