Open kursadaltan opened 3 years ago
You may need a patch
Modify composer.json as follows, and then execute composer update
"require": {
"bluerhinos/phpmqtt": "@dev",
"cweagans/composer-patches": "^1.6"
},
"extra": {
"patches": {
"bluerhinos/phpmqtt": {
"PHP8": "https://raw.githubusercontent.com/politsin/snipets/master/patch/mqtt-php8.patch"
}
}
}
Thank for reply. When I make composer update, I get Could not apply patch! Skipping. The error was: Cannot apply patch https://raw.githubusercontent.com/politsin/snipets/master/patch/mqtt-php8.patch error. And dont change anythings.
Try composer install and
"cweagans/composer-patches": "^1.6"
Package is required
I added "cweagans/composer-patches": "^1.6" package already. But I take a error. I didn't understand. And I did manual update MQTT class.
phpMQTT.php class does not work in PHP8 version. Because Array and string offset access syntax with curly braces is deprecated. When I change deprecated line to [-] characters give a empty string error. I added a small control code in connect function. And this class is working for me.
I make this.
//Check String variable Start if(empty($string)){ $this->_errorMessage( sprintf( "Connection failed!\n"
) ); return false; } // Check String Variable End