Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Use the URI parser defined in Predis\Connection\ConnectionParameters.

This change requires a bump of the minimum required version of Predis
to v0.8.3.
  • Loading branch information...
commit e57ec3f47fac8cc2acba0ec76fa29464db77e811 1 parent 2cf468f
Daniele Alessandri authored March 19, 2013
2  CHANGELOG
@@ -3,6 +3,8 @@ v0.4.1 (2013-03-19)
3 3
     of `Predis\ClientInterface` returned by the provider when creating a new
4 4
     client object.
5 5
 
  6
+  * Minimum required version of Predis is now v0.8.3.
  7
+
6 8
 v0.4.0 (2013-02-03)
7 9
   * The service provider now requires Predis v0.8.
8 10
 
2  composer.json
@@ -17,7 +17,7 @@
17 17
     },
18 18
     "require": {
19 19
         "php": ">=5.3.2",
20  
-        "predis/predis": "0.8.*@stable",
  20
+        "predis/predis": "~0.8.3@stable",
21 21
         "silex/silex": "1.0.*@dev"
22 22
     }
23 23
 }
22  lib/Predis/Silex/PredisServiceProvider.php
@@ -13,6 +13,7 @@
13 13
 
14 14
 use InvalidArgumentException;
15 15
 use Predis\Client;
  16
+use Predis\Connection\ConnectionParameters;
16 17
 use Silex\Application;
17 18
 use Silex\ServiceProviderInterface;
18 19
 
@@ -112,27 +113,8 @@ public function register(Application $app)
112 113
         $app["$prefix.default_parameters"] = array();
113 114
         $app["$prefix.default_options"] = array();
114 115
 
115  
-        // NOTE: too bad we are forced to copy Predis\Connection\ConnectionParameters::parseURI()...
116 116
         $app["$prefix.uri_parser"] = $app->protect(function ($uri) {
117  
-            if (stripos($uri, 'unix') === 0) {
118  
-                // Hack to support URIs for UNIX sockets with minimal effort.
119  
-                $uri = str_ireplace('unix:///', 'unix://localhost/', $uri);
120  
-            }
121  
-
122  
-            if (($parsed = @parse_url($uri)) === false || !isset($parsed['host'])) {
123  
-                throw new InvalidArgumentException("Invalid URI string: $uri");
124  
-            }
125  
-
126  
-            if (isset($parsed['query'])) {
127  
-                foreach (explode('&', $parsed['query']) as $kv) {
128  
-                    @list($k, $v) = explode('=', $kv);
129  
-                    $parsed[$k] = $v;
130  
-                }
131  
-
132  
-                unset($parsed['query']);
133  
-            }
134  
-
135  
-            return $parsed;
  117
+            return ConnectionParameters::parseURI($uri);
136 118
         });
137 119
 
138 120
         $app["$prefix.client_constructor"] = $app->protect(function ($parameters, $options) {

0 notes on commit e57ec3f

Please sign in to comment.
Something went wrong with that request. Please try again.