bluerhinos / phpMQTT

a simple php class to connect/publish/subscribe to a MQTT broker
Other
765 stars 461 forks source link

Uninitialized string offset: 0 #108

Open arieffathir opened 3 years ago

arieffathir commented 3 years ago

There is error Uninitialized string offset: 0 in line number Line Number: 238 already change code buffer to "

    $buffer .= chr(0x00);$i++; // Length MSB
    $buffer .= chr(0x04);$i++; // Length LSB
    $buffer .= chr(0x4d);$i++; // M
    $buffer .= chr(0x51);$i++; // Q
    $buffer .= chr(0x54);$i++; // T
    $buffer .= chr(0x54);$i++; // T
    $buffer .= chr(0x04);$i++; // // Protocol Level

Using PHP 7 (Codeigniter) Using CloudMQTT

Please help.

xuchl commented 2 years ago

maybe like this
$socketContext = stream_context_create( [ 'ssl' => [ 'verify_peer_name' => true, 'cafile' => $this->cafile, 'local_cert'=>$this->local_cert, 'local_pk'=>$this->local_pk, ] ] );