Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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
@nrk authored
View
2  CHANGELOG
@@ -3,6 +3,8 @@ v0.4.1 (2013-03-19)
of `Predis\ClientInterface` returned by the provider when creating a new
client object.
+ * Minimum required version of Predis is now v0.8.3.
+
v0.4.0 (2013-02-03)
* The service provider now requires Predis v0.8.
View
2  composer.json
@@ -17,7 +17,7 @@
},
"require": {
"php": ">=5.3.2",
- "predis/predis": "0.8.*@stable",
+ "predis/predis": "~0.8.3@stable",
"silex/silex": "1.0.*@dev"
}
}
View
22 lib/Predis/Silex/PredisServiceProvider.php
@@ -13,6 +13,7 @@
use InvalidArgumentException;
use Predis\Client;
+use Predis\Connection\ConnectionParameters;
use Silex\Application;
use Silex\ServiceProviderInterface;
@@ -112,27 +113,8 @@ public function register(Application $app)
$app["$prefix.default_parameters"] = array();
$app["$prefix.default_options"] = array();
- // NOTE: too bad we are forced to copy Predis\Connection\ConnectionParameters::parseURI()...
$app["$prefix.uri_parser"] = $app->protect(function ($uri) {
- if (stripos($uri, 'unix') === 0) {
- // Hack to support URIs for UNIX sockets with minimal effort.
- $uri = str_ireplace('unix:///', 'unix://localhost/', $uri);
- }
-
- if (($parsed = @parse_url($uri)) === false || !isset($parsed['host'])) {
- throw new InvalidArgumentException("Invalid URI string: $uri");
- }
-
- if (isset($parsed['query'])) {
- foreach (explode('&', $parsed['query']) as $kv) {
- @list($k, $v) = explode('=', $kv);
- $parsed[$k] = $v;
- }
-
- unset($parsed['query']);
- }
-
- return $parsed;
+ return ConnectionParameters::parseURI($uri);
});
$app["$prefix.client_constructor"] = $app->protect(function ($parameters, $options) {
Please sign in to comment.
Something went wrong with that request. Please try again.