Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TLS & PHP8 composer-patches #122

Open
politsin opened this issue Jun 8, 2021 · 1 comment
Open

TLS & PHP8 composer-patches #122

politsin opened this issue Jun 8, 2021 · 1 comment

Comments

@politsin
Copy link

politsin commented Jun 8, 2021

{
    "require": {
        ...
        "cweagans/composer-patches": "^1.6",
   ...
    "extra": {
        "patches": {
            "bluerhinos/phpmqtt": {
                "TLS": "https://raw.githubusercontent.com/politsin/snipets/master/patch/phpMQTT.patch",
                "PHP8": "https://raw.githubusercontent.com/politsin/snipets/master/patch/mqtt-php8.patch"
            }
        }
   }
}
@politsin politsin changed the title TLS & PHP8 patches TLS & PHP8 composer-patches Jun 8, 2021
@politsin
Copy link
Author

TLS support

diff --git a/phpMQTT.php b/phpMQTT.php
index 92b65c6..6ebddeb 100644
--- a/phpMQTT.php
+++ b/phpMQTT.php
@@ -147,7 +147,7 @@ class phpMQTT
             );
             $this->socket = stream_socket_client('tls://' . $this->address . ':' . $this->port, $errno, $errstr, 60, STREAM_CLIENT_CONNECT, $socketContext);
         } else {
-            $this->socket = stream_socket_client('tcp://' . $this->address . ':' . $this->port, $errno, $errstr, 60, STREAM_CLIENT_CONNECT);
+            $this->socket = stream_socket_client('tls://' . $this->address . ':' . $this->port, $errno, $errstr, 60, STREAM_CLIENT_CONNECT);
         }
 
         if (!$this->socket) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant