krowinski / php-mysql-replication

Pure PHP Implementation of MySQL replication protocol. This allow you to receive event like insert, update, delete with their data and raw SQL queries.
MIT License
323 stars 98 forks source link

unpack(): Type C: not enough input values #123

Open ronenb75 opened 4 months ago

ronenb75 commented 4 months ago

Please provide the following details.

Steps required to reproduce the problem.

Using a modified version of the dump_events.php script, produce an error:

TypeError: MySQLReplication\BinaryDataReader\BinaryDataReader::readUInt8(): Return value must be of type int, null returned in /opt/vendor/krowinski/php-mysql-replication/src/MySQLReplication/BinaryDataReader/BinaryDataReader.php:182

Stack trace:

#0 /opt/vendor/krowinski/php-mysql-replication/src/MySQLReplication/BinaryDataReader/BinaryDataReader.php(156): MySQLReplication\BinaryDataReader\BinaryDataReader->readUInt8()
#1 /opt/vendor/krowinski/php-mysql-replication/src/MySQLReplication/BinaryDataReader/BinaryDataReader.php(150): MySQLReplication\BinaryDataReader\BinaryDataReader->readUIntBySize(1)
#2 /opt/vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/RowEvent/RowEvent.php(614): MySQLReplication\BinaryDataReader\BinaryDataReader->readLengthString(1)
#3 /opt/vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/RowEvent/RowEvent.php(532): MySQLReplication\Event\RowEvent\RowEvent->getString(1)
#4 /opt/vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/RowEvent/RowEvent.php(458): MySQLReplication\Event\RowEvent\RowEvent->getColumnData('\x12\x00\x13')
#5 /opt/vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/RowEvent/RowEvent.php(378): MySQLReplication\Event\RowEvent\RowEvent->getValues()
#6 /opt/vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/Event.php(101): MySQLReplication\Event\RowEvent\RowEvent->makeWriteRowsDTO()
#7 /opt/vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/Event.php(45): MySQLReplication\Event\Event->makeEvent(Object(MySQLReplication\BinaryDataReader\BinaryDataReader))
#8 /opt/vendor/krowinski/php-mysql-replication/src/MySQLReplication/MySQLReplicationFactory.php(109): MySQLReplication\Event\Event->consume()
#9 /opt/vendor/krowinski/php-mysql-replication/src/MySQLReplication/MySQLReplicationFactory.php(103): MySQLReplication\MySQLReplicationFactory->consume()
#10 /opt/cdc.php(145): MySQLReplication\MySQLReplicationFactory->run()
#11 {main}

I'm not sure how I can pinpoint the offending row as the exception happens before I can output any information about this row. I'd be happy to provide the actual row if there's a way to grab any information of the offending row.