diff --git a/lib/Predis/Configuration/ProfileOption.php b/lib/Predis/Configuration/ProfileOption.php index 45385e6b..300f7d47 100644 --- a/lib/Predis/Configuration/ProfileOption.php +++ b/lib/Predis/Configuration/ProfileOption.php @@ -33,7 +33,12 @@ class ProfileOption implements OptionInterface protected function setProcessors(OptionsInterface $options, ProfileInterface $profile) { if (isset($options->prefix) && $profile instanceof RedisProfile) { - $profile->setProcessor($options->prefix); + // NOTE: directly using __get('prefix') is actually a workaround for + // HHVM 2.3.0. It's correct and respects the options interface, it's + // just ugly. We will remove this hack when HHVM will fix re-entrant + // calls to __get() once and for all. + + $profile->setProcessor($options->__get('prefix')); } } diff --git a/lib/Predis/Connection/StreamConnection.php b/lib/Predis/Connection/StreamConnection.php index 02b23268..5ff686a1 100644 --- a/lib/Predis/Connection/StreamConnection.php +++ b/lib/Predis/Connection/StreamConnection.php @@ -92,7 +92,7 @@ class StreamConnection extends AbstractConnection stream_set_timeout($resource, $timeoutSeconds, $timeoutUSeconds); } - if (isset($parameters->tcp_nodelay) && version_compare(PHP_VERSION, '5.4.0') >= 0) { + if (isset($parameters->tcp_nodelay) && function_exists('socket_import_stream')) { $socket = socket_import_stream($resource); socket_set_option($socket, SOL_TCP, TCP_NODELAY, (int) $parameters->tcp_nodelay); } diff --git a/tests/Predis/Command/RawCommandTest.php b/tests/Predis/Command/RawCommandTest.php index 7ebf5eb0..b9b07fe5 100644 --- a/tests/Predis/Command/RawCommandTest.php +++ b/tests/Predis/Command/RawCommandTest.php @@ -69,9 +69,12 @@ class RawCommandTest extends PredisTestCase } /** + * The signature of RawCommand::create() requires one argument which is the + * ID of the command (other arguments are fetched dinamically). If the first + * argument is missing, PHP emits an E_WARNING. + * * @group disconnected * @expectedException PHPUnit_Framework_Error_Warning - * @expectedExceptionMessage Missing argument 1 for Predis\Command\RawCommand::create() */ public function testPHPWarningOnMissingCommandIDWithStaticCreate() {