From 33ffca23a0de7b353a4e1c17fce9a95251e0aebf Mon Sep 17 00:00:00 2001 From: Daniele Alessandri Date: Wed, 2 Mar 2011 15:16:49 +0100 Subject: [PATCH] Check if the socket extension is loaded. --- lib/Predis/Network/PhpiredisConnection.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/Predis/Network/PhpiredisConnection.php b/lib/Predis/Network/PhpiredisConnection.php index 1effb14f..9db86d4e 100644 --- a/lib/Predis/Network/PhpiredisConnection.php +++ b/lib/Predis/Network/PhpiredisConnection.php @@ -28,6 +28,12 @@ class PhpiredisConnection extends ConnectionBase { private $_reader, $_throwErrors; public function __construct(ConnectionParameters $parameters) { + if (!function_exists('socket_create')) { + throw new ClientException( + 'The socket extension must be loaded in order to be able to ' . + 'use this connection class' + ); + } parent::__construct($this->checkParameters($parameters)); $this->_throwErrors = true; $this->initializeReader(); @@ -63,8 +69,8 @@ class PhpiredisConnection extends ConnectionBase { private function initializeReader() { if (!function_exists('phpiredis_reader_create')) { throw new ClientException( - 'The phpiredis extension must be loaded in order to ' . - 'be able to use this protocol processor' + 'The phpiredis extension must be loaded in order to be able to ' . + 'use this connection class' ); } $this->_reader = phpiredis_reader_create();