From e2d25510b219f466212faf35479e1dbe837b81bd Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Tue, 1 Mar 2016 10:50:34 +0100 Subject: [PATCH 1/3] Update .travis.yml and travis-init.sh for PHP 7 - there is no `hhvm-nightly` anymore on travis https://github.com/travis-ci/travis-ci/issues/3788#issuecomment-97171678 - add php 7 - `event` extension works - `libev` does not support PHP 7 (yet?) https://github.com/m4rw3r/php-libev/issues/8 - `libevent` also does not support PHP 7 https://pecl.php.net/package/libevent --- .travis.yml | 3 +-- travis-init.sh | 40 ++++++++++++++++++++++------------------ 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/.travis.yml b/.travis.yml index d5118a82..66bf8f80 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,13 +4,12 @@ php: - 5.4 - 5.5 - 5.6 + - 7.0 - hhvm - - hhvm-nightly matrix: allow_failures: - php: hhvm - - php: hhvm-nightly fast_finish: true install: ./travis-init.sh diff --git a/travis-init.sh b/travis-init.sh index 63deeb85..07b1d2a8 100755 --- a/travis-init.sh +++ b/travis-init.sh @@ -11,25 +11,29 @@ if [[ "$TRAVIS_PHP_VERSION" != "hhvm" && # install 'event' PHP extension echo "yes" | pecl install event - # install 'libevent' PHP extension - curl http://pecl.php.net/get/libevent-0.1.0.tgz | tar -xz - pushd libevent-0.1.0 - phpize - ./configure - make - make install - popd - echo "extension=libevent.so" >> "$(php -r 'echo php_ini_loaded_file();')" + # install 'libevent' PHP extension (does not support php 7) + if [[ "$TRAVIS_PHP_VERSION" != "7.0" ]]; then + curl http://pecl.php.net/get/libevent-0.1.0.tgz | tar -xz + pushd libevent-0.1.0 + phpize + ./configure + make + make install + popd + echo "extension=libevent.so" >> "$(php -r 'echo php_ini_loaded_file();')" + fi - # install 'libev' PHP extension - git clone --recursive https://github.com/m4rw3r/php-libev - pushd php-libev - phpize - ./configure --with-libev - make - make install - popd - echo "extension=libev.so" >> "$(php -r 'echo php_ini_loaded_file();')" + # install 'libev' PHP extension (does not support php 7) + if [[ "$TRAVIS_PHP_VERSION" != "7.0" ]]; then + git clone --recursive https://github.com/m4rw3r/php-libev + pushd php-libev + phpize + ./configure --with-libev + make + make install + popd + echo "extension=libev.so" >> "$(php -r 'echo php_ini_loaded_file();')" + fi fi From 913f1507a9c448a320bd60dc5a1da5bd71ff3e8d Mon Sep 17 00:00:00 2001 From: Ondrej Mirtes Date: Sun, 6 Dec 2015 11:18:15 +0100 Subject: [PATCH 2/3] Fix for PHP 7 fatal error on duplicate parameter names in closures --- src/ExtEventLoop.php | 2 +- src/LibEventLoop.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ExtEventLoop.php b/src/ExtEventLoop.php index 48657f96..7160c908 100644 --- a/src/ExtEventLoop.php +++ b/src/ExtEventLoop.php @@ -294,7 +294,7 @@ private function unsubscribeStreamEvent($stream, $flag) */ private function createTimerCallback() { - $this->timerCallback = function ($_, $_, $timer) { + $this->timerCallback = function ($_, $__, $timer) { call_user_func($timer->getCallback(), $timer); if (!$timer->isPeriodic() && $this->isTimerActive($timer)) { diff --git a/src/LibEventLoop.php b/src/LibEventLoop.php index 6fbc8269..99417a12 100644 --- a/src/LibEventLoop.php +++ b/src/LibEventLoop.php @@ -298,7 +298,7 @@ private function unsubscribeStreamEvent($stream, $flag) */ private function createTimerCallback() { - $this->timerCallback = function ($_, $_, $timer) { + $this->timerCallback = function ($_, $__, $timer) { call_user_func($timer->getCallback(), $timer); // Timer already cancelled ... From c0c889f88fec4529ca8af0cd00d2b9fac4bb49b0 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Fri, 4 Mar 2016 01:17:49 +0100 Subject: [PATCH 3/3] fixed tests for HHVM, fixes #24 --- .travis.yml | 5 ----- tests/AbstractLoopTest.php | 6 +++--- tests/StreamSelectLoopTest.php | 11 +++++++++++ 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 66bf8f80..6b771592 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,11 +7,6 @@ php: - 7.0 - hhvm -matrix: - allow_failures: - - php: hhvm - fast_finish: true - install: ./travis-init.sh script: diff --git a/tests/AbstractLoopTest.php b/tests/AbstractLoopTest.php index 17163e8b..29bde5aa 100644 --- a/tests/AbstractLoopTest.php +++ b/tests/AbstractLoopTest.php @@ -176,7 +176,7 @@ public function runShouldReturnWhenNoMoreFds() $this->writeToStream($input, "foo\n"); - $this->assertRunFasterThan(0.005); + $this->assertRunFasterThan(0.015); } /** @test */ @@ -194,7 +194,7 @@ public function stopShouldStopRunningLoop() $this->assertRunFasterThan(0.005); } - public function testStopShouldPreventRunFromBlocking() + public function testStopShouldPreventRunFromBlocking($timeLimit = 0.005) { $this->loop->addTimer( 1, @@ -209,7 +209,7 @@ function () { } ); - $this->assertRunFasterThan(0.005); + $this->assertRunFasterThan($timeLimit); } public function testIgnoreRemovedCallback() diff --git a/tests/StreamSelectLoopTest.php b/tests/StreamSelectLoopTest.php index 61b059c1..624ee447 100644 --- a/tests/StreamSelectLoopTest.php +++ b/tests/StreamSelectLoopTest.php @@ -37,6 +37,17 @@ public function testStreamSelectTimeoutEmulation() $this->assertGreaterThan(0.04, $interval); } + public function testStopShouldPreventRunFromBlocking($timeLimit = 0.005) + { + if (defined('HHVM_VERSION')) { + // HHVM is a bit slow, so give it more time + parent::testStopShouldPreventRunFromBlocking(0.5); + } else { + parent::testStopShouldPreventRunFromBlocking($timeLimit); + } + } + + public function signalProvider() { return [ 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