Browse Source

Merge pull request #13553 from CakeDC/issue/socket-null-port

allow socket to connect to unix file based sockets
Mark Story 6 years ago
parent
commit
2571f13e01
1 changed files with 6 additions and 1 deletions
  1. 6 1
      src/Network/Socket.php

+ 6 - 1
src/Network/Socket.php

@@ -161,8 +161,13 @@ class Socket
         }
 
         set_error_handler([$this, '_connectionErrorHandler']);
+        $remoteSocketTarget = $scheme . $this->_config['host'];
+        $port = (int)$this->_config['port'];
+        if ($port > 0) {
+            $remoteSocketTarget .= ':' . $port;
+        }
         $this->connection = stream_socket_client(
-            $scheme . $this->_config['host'] . ':' . $this->_config['port'],
+            $remoteSocketTarget,
             $errNum,
             $errStr,
             $this->_config['timeout'],