unreal4u / mqtt

PHP7+ MQTT client with **full** protocol support
MIT License
15 stars 4 forks source link

Some published messages from the broker have an invalid TopicName #9

Closed unreal4u closed 5 years ago

unreal4u commented 5 years ago

It happens when the remaining length is over 127 bytes, in which case that field can range anywhere from 1 to 4 bytes, offsetting the entire message.

Interesting fact is that this was implemented for WritableContent, but not for ReadableContent. Implement this.

Stack trace:

 unreal4u\MQTT\DataTypes\TopicName->setTopicName() at /home/homeautomation/mqtt-monolog/vendor/unreal4u/mqtt/src/DataTypes/TopicName.php:31
 unreal4u\MQTT\DataTypes\TopicName->__construct() at /home/homeautomation/mqtt-monolog/vendor/unreal4u/mqtt/src/Protocol/Publish.php:307
 unreal4u\MQTT\Protocol\Publish->fillObject() at /home/homeautomation/mqtt-monolog/vendor/unreal4u/mqtt/src/Internals/ReadableContent.php:31
 unreal4u\MQTT\Protocol\Publish->instantiateObject() at /home/homeautomation/mqtt-monolog/vendor/unreal4u/mqtt/src/Internals/EventManager.php:92
 unreal4u\MQTT\Internals\EventManager->analyzeHeaders() at /home/homeautomation/mqtt-monolog/vendor/unreal4u/mqtt/src/Protocol/Subscribe.php:105
 unreal4u\MQTT\Protocol\Subscribe->checkForEvent() at /home/homeautomation/mqtt-monolog/vendor/unreal4u/mqtt/src/Protocol/Subscribe.php:152
 unreal4u\MQTT\Protocol\Subscribe->loop() at /home/homeautomation/mqtt-monolog/vendor/unreal4u/rpi-common-libraries/src/Communications/MQTT/Operations.php:120
 unreal4u\rpiCommonLibrary\Communications\MQTT\Operations->subscribeToTopic() at /home/homeautomation/mqtt-monolog/app/SubscribeAndPublish.php:49
 unreal4u\mqttMonolog\SubscribeAndPublish->runJob() at /home/homeautomation/mqtt-monolog/vendor/unreal4u/rpi-common-libraries/src/Base.php:167
 unreal4u\rpiCommonLibrary\Base->execute() at /home/homeautomation/mqtt-monolog/vendor/symfony/console/Command/Command.php:255
 Symfony\Component\Console\Command\Command->run() at /home/homeautomation/mqtt-monolog/vendor/symfony/console/Application.php:908
 Symfony\Component\Console\Application->doRunCommand() at /home/homeautomation/mqtt-monolog/vendor/symfony/console/Application.php:269
 Symfony\Component\Console\Application->doRun() at /home/homeautomation/mqtt-monolog/vendor/symfony/console/Application.php:145
 Symfony\Component\Console\Application->run() at /home/homeautomation/mqtt-monolog/bin/console:14
unreal4u commented 5 years ago

Development is being done in the following branch: https://github.com/unreal4u/mqtt/tree/issue/9-allow-big-incoming-messages