Преглед изворни кода

Make Predis v0.8 compatible with HHVM 2.4.0.

Since we cannot rely on the PHP version to detect the availability of
socket_import_stream(), we switched to function_exists(). As an added
bonus, using function_exists() is twice faster.
Daniele Alessandri пре 11 година
родитељ
комит
60733eb5c9
1 измењених фајлова са 1 додато и 1 уклоњено
  1. 1 1
      lib/Predis/Connection/StreamConnection.php

+ 1 - 1
lib/Predis/Connection/StreamConnection.php

@@ -104,7 +104,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);
         }