From bda850fdb4d67b0a5d316e36cdd01ac3842345d9 Mon Sep 17 00:00:00 2001 From: Chris Boden Date: Thu, 17 Nov 2016 11:49:01 -0500 Subject: [PATCH 1/2] Discourage libevent on PHP 7 --- src/Factory.php | 7 ++++--- src/LibEventLoop.php | 4 ++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Factory.php b/src/Factory.php index 9a481e35..271c2654 100644 --- a/src/Factory.php +++ b/src/Factory.php @@ -7,12 +7,13 @@ class Factory public static function create() { // @codeCoverageIgnoreStart - if (function_exists('event_base_new')) { - return new LibEventLoop(); - } elseif (class_exists('libev\EventLoop', false)) { + if (class_exists('libev\EventLoop', false)) { return new LibEvLoop; } elseif (class_exists('EventBase', false)) { return new ExtEventLoop; + } elseif (function_exists('event_base_new') && PHP_VERSION_ID < 70000) { + // only use ext-libevent on PHP < 7 for now + return new LibEventLoop(); } return new StreamSelectLoop(); diff --git a/src/LibEventLoop.php b/src/LibEventLoop.php index 4b252d45..ff27cd2d 100644 --- a/src/LibEventLoop.php +++ b/src/LibEventLoop.php @@ -29,6 +29,10 @@ class LibEventLoop implements LoopInterface public function __construct() { + if (version_compare(PHP_VERSION, '7.0.0') >= 0) { + trigger_error('The libevent extension has not yet been updated for PHP 7, it is recommended you use a different loop', E_USER_WARNING); + } + $this->eventBase = event_base_new(); $this->futureTickQueue = new FutureTickQueue(); $this->timerEvents = new SplObjectStorage(); From f1c4746aed686fad34b149eaef37c3ea38eb9df9 Mon Sep 17 00:00:00 2001 From: Chris Boden Date: Wed, 11 Oct 2017 09:38:07 -0400 Subject: [PATCH 2/2] Remove warning on invalid version mismatch --- src/LibEventLoop.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/LibEventLoop.php b/src/LibEventLoop.php index ff27cd2d..4b252d45 100644 --- a/src/LibEventLoop.php +++ b/src/LibEventLoop.php @@ -29,10 +29,6 @@ class LibEventLoop implements LoopInterface public function __construct() { - if (version_compare(PHP_VERSION, '7.0.0') >= 0) { - trigger_error('The libevent extension has not yet been updated for PHP 7, it is recommended you use a different loop', E_USER_WARNING); - } - $this->eventBase = event_base_new(); $this->futureTickQueue = new FutureTickQueue(); $this->timerEvents = new SplObjectStorage(); pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy