amphp / mysql

An async MySQL client for PHP, optimizing database interactions with efficient non-blocking capabilities. Perfect for responsive, high-performance applications.
Other
358 stars 63 forks source link

Notice when decoding OK packets #29

Closed marcioAlmada closed 7 years ago

marcioAlmada commented 7 years ago

Looking at server logs the following notice happens quite frequently:

notice Uninitialized string offset: 9 in ../vendor/amphp/mysql/lib/DataTypes.php on line 202

Database interaction works fine, but this impedes usage of a more picky error handler.

marcioAlmada commented 7 years ago

A stack trace:

Exception: Uninitialized string offset: 9 in /amphp/mysql/lib/DataTypes.php:204
Stack trace:
#0 /amphp/mysql/lib/DataTypes.php(204): Aerys\Bootstrapper->{closure}(8, 'Uninitialized s...', '/.../...', 204, Array)
#1 /amphp/mysql/lib/DataTypes.php(196): Amp\Mysql\DataTypes::decodeIntOff('\x00\x01\xFC\xC7\x0E\x03\x00\x00\x00', 9)
#2 /amphp/mysql/lib/Processor.php(427): Amp\Mysql\DataTypes::decodeStringOff('\x00\x01\xFC\xC7\x0E\x03\x00\x00\x00', 9)
#3 /amphp/mysql/lib/Processor.php(462): Amp\Mysql\Processor->parseOk('\x00\x01\xFC\xC7\x0E\x03\x00\x00\x00')
#4 /amphp/mysql/lib/Processor.php(1091): Amp\Mysql\Processor->handleOk('\x00\x01\xFC\xC7\x0E\x03\x00\x00\x00')
#5 /amphp/mysql/lib/Processor.php(931): Amp\Mysql\Processor->parsePayload('\x00\x01\xFC\xC7\x0E\x03\x00\x00\x00')
#6 /amphp/amp/lib/UvReactor.php(424): Amp\Mysql\Processor->onRead('000000005a1097e...', Resource id #250, NULL)
#7 /amphp/amp/lib/UvReactor.php(401): Amp\UvReactor->invokePollWatcher(Object(stdClass))
marcioAlmada commented 7 years ago

It seems $off should not be 9 in this case https://dev.mysql.com/doc/internals/en/packet-OK_Packet.html

marcioAlmada commented 7 years ago

I can no longer reproduce the issue after https://github.com/amphp/mysql/commit/21801b09af6da5d14c949cc0b6ce1c260330c30d#diff-b7c6c28a97dddfea08068fa97b76dafdR426 :D

Can we close this one?

bwoebi commented 7 years ago

Oh, I thought I already committed that beforehand. Looks like I missed to commit something in between.

Well, if that fixes it, then let's close this issue :-)