Browse Source

Better checks for arguments passed to Predis\Network\UnixDomainSocketConnection.

Daniele Alessandri 14 years ago
parent
commit
c94cf5ef32
1 changed files with 6 additions and 2 deletions
  1. 6 2
      lib/Predis.php

+ 6 - 2
lib/Predis.php

@@ -1375,8 +1375,12 @@ class UnixDomainSocketConnection extends TcpConnection {
         if ($parameters->scheme != 'unix') {
             throw new \InvalidArgumentException("Invalid scheme: {$parameters->scheme}");
         }
-        if (!file_exists($parameters->path)) {
-            throw new \InvalidArgumentException("Could not find {$parameters->path}");
+        $pathToSocket = $parameters->path;
+        if (!isset($pathToSocket)) {
+            throw new \InvalidArgumentException('Missing UNIX domain socket path');
+        }
+        if (!file_exists($pathToSocket)) {
+            throw new \InvalidArgumentException("Could not find $pathToSocket");
         }
         return $parameters;
     }