Skip to content

Commit 21801b0

Browse files
committed
Fix $restore callback calls
1 parent 31d2956 commit 21801b0

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/Connection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ public function __construct($config, $sslOptions = null) {
3737
$cb($hash);
3838
}
3939
};
40-
$restore = static function() use ($hash, $config) {
40+
$restore = static function($init) use ($hash, $config) {
4141
$cb = $config->restore;
4242
if (isset($cb)) {
43-
$cb($hash);
43+
$cb($hash, $init);
4444
}
4545
};
4646
$this->processor = new Processor($ready, $busy, $restore);

lib/Processor.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ private function parseOk($packet) {
423423

424424
if ($this->capabilities & self::CLIENT_SESSION_TRACK) {
425425
// Even though it seems required according to 14.1.3.1, there is no length encoded string, i.e. no trailing NULL byte ....???
426-
if (\strlen($packet) > 7) {
426+
if (\strlen($packet) > $off) {
427427
$this->connInfo->statusInfo = DataTypes::decodeStringOff($packet, $off);
428428

429429
if ($this->connInfo->statusFlags & StatusFlags::SERVER_SESSION_STATE_CHANGED) {
@@ -948,8 +948,8 @@ private function goneAway() {
948948
}
949949
}
950950
$this->closeSocket();
951-
if (null !== $cb = $this->config->restore) {
952-
$cb(spl_object_hash($this), $this->connectionState < self::READY);
951+
if (null !== $cb = $this->restore) {
952+
$cb($this->connectionState < self::READY);
953953
/* @TODO if packet not completely sent, resend? */
954954
}
955955
}

0 commit comments

Comments
 (0)