Skip to content

Drop deprecated ExtLibeventLoop and ExtLibevLoop (PHP 5 only) #273

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 1 addition & 29 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -43,7 +43,7 @@ jobs:

PHPUnit-Unstable:
name: PHPUnit (Unstable PHP ${{ matrix.php }})
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
continue-on-error: true
strategy:
matrix:
@@ -57,10 +57,6 @@ jobs:
- 7.2
- 7.1
- 7.0
- 5.6
- 5.5
- 5.4
- 5.3
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
@@ -74,30 +70,6 @@ jobs:
sudo apt-get update -q && sudo apt-get install libuv1-dev
echo "yes" | sudo pecl install ${{ matrix.php >= 8.0 && 'uv-0.3.0' || 'uv-0.2.4' }}
php -m | grep -q uv || echo "extension=uv.so" >> "$(php -r 'echo php_ini_loaded_file();')"
if: ${{ matrix.php >= 7.0 }}
- name: Install legacy ext-libevent on PHP < 7.0
run: |
sudo apt-get update && sudo apt-get install libevent-dev
curl http://pecl.php.net/get/libevent-0.1.0.tgz | tar -xz
pushd libevent-0.1.0
phpize
./configure
make
sudo make install
popd
echo "extension=libevent.so" | sudo tee -a "$(php -r 'echo php_ini_loaded_file();')"
if: ${{ matrix.php < 7.0 }}
- name: Install legacy ext-libev on PHP < 7.0
run: |
git clone --recursive https://github.com/m4rw3r/php-libev
pushd php-libev
phpize
./configure --with-libev
make
sudo make install
popd
echo "extension=libev.so" | sudo tee -a "$(php -r 'echo php_ini_loaded_file();')"
if: ${{ matrix.php < 7.0 }}
- run: composer install
- run: vendor/bin/phpunit --coverage-text
if: ${{ matrix.php >= 7.3 }}
42 changes: 0 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
@@ -33,8 +33,6 @@ single [`run()`](#run) call that is controlled by the user.
* [ExtEventLoop](#exteventloop)
* [ExtEvLoop](#extevloop)
* [ExtUvLoop](#extuvloop)
* [~~ExtLibeventLoop~~](#extlibeventloop)
* [~~ExtLibevLoop~~](#extlibevloop)
* [LoopInterface](#loopinterface)
* [run()](#run)
* [stop()](#stop)
@@ -429,46 +427,6 @@ that provides an interface to `libuv` library.

This loop is known to work with PHP 7+.

#### ~~ExtLibeventLoop~~

> Deprecated since v1.2.0, use [`ExtEventLoop`](#exteventloop) instead.
An `ext-libevent` based event loop.

This uses the [`libevent` PECL extension](https://pecl.php.net/package/libevent),
that provides an interface to `libevent` library.
`libevent` itself supports a number of system-specific backends (epoll, kqueue).

This event loop does only work with PHP 5.
An [unofficial update](https://github.com/php/pecl-event-libevent/pull/2) for
PHP 7 does exist, but it is known to cause regular crashes due to `SEGFAULT`s.
To reiterate: Using this event loop on PHP 7 is not recommended.
Accordingly, neither the [`Loop` class](#loop) nor the deprecated
[`Factory` class](#factory) will try to use this event loop on PHP 7.

This event loop is known to trigger a readable listener only if
the stream *becomes* readable (edge-triggered) and may not trigger if the
stream has already been readable from the beginning.
This also implies that a stream may not be recognized as readable when data
is still left in PHP's internal stream buffers.
As such, it's recommended to use `stream_set_read_buffer($stream, 0);`
to disable PHP's internal read buffer in this case.
See also [`addReadStream()`](#addreadstream) for more details.

#### ~~ExtLibevLoop~~

> Deprecated since v1.2.0, use [`ExtEvLoop`](#extevloop) instead.
An `ext-libev` based event loop.

This uses an [unofficial `libev` extension](https://github.com/m4rw3r/php-libev),
that provides an interface to `libev` library.
`libev` itself supports a number of system-specific backends (epoll, kqueue).

This loop does only work with PHP 5.
An update for PHP 7 is [unlikely](https://github.com/m4rw3r/php-libev/issues/8)
to happen any time soon.

### LoopInterface

#### run()
201 changes: 0 additions & 201 deletions src/ExtLibevLoop.php

This file was deleted.

285 changes: 0 additions & 285 deletions src/ExtLibeventLoop.php

This file was deleted.

9 changes: 0 additions & 9 deletions src/Factory.php
Original file line number Diff line number Diff line change
@@ -52,10 +52,6 @@ private static function construct()
return new ExtUvLoop();
}

if (\class_exists('libev\EventLoop', false)) {
return new ExtLibevLoop();
}

if (\class_exists('EvLoop', false)) {
return new ExtEvLoop();
}
@@ -64,11 +60,6 @@ private static function construct()
return new ExtEventLoop();
}

if (\function_exists('event_base_new') && \PHP_MAJOR_VERSION === 5) {
// only use ext-libevent on PHP 5 for now
return new ExtLibeventLoop();
}

return new StreamSelectLoop();
// @codeCoverageIgnoreEnd
}
5 changes: 2 additions & 3 deletions src/StreamSelectLoop.php
Original file line number Diff line number Diff line change
@@ -15,9 +15,8 @@
* This event loop works out of the box on PHP 5.4 through PHP 8+ and HHVM.
* This means that no installation is required and this library works on all
* platforms and supported PHP versions.
* Accordingly, the [`Loop` class](#loop) and the deprecated [`Factory`](#factory)
* will use this event loop by default if you do not install any of the event loop
* extensions listed below.
* Accordingly, the [`Loop` class](#loop) will use this event loop by default if
* you do not install any of the event loop extensions listed below.
*
* Under the hood, it does a simple `select` system call.
* This system call is limited to the maximum file descriptor number of
22 changes: 0 additions & 22 deletions tests/ExtLibevLoopTest.php

This file was deleted.

63 changes: 0 additions & 63 deletions tests/ExtLibeventLoopTest.php

This file was deleted.

17 changes: 0 additions & 17 deletions tests/Timer/ExtLibevTimerTest.php

This file was deleted.

17 changes: 0 additions & 17 deletions tests/Timer/ExtLibeventTimerTest.php

This file was deleted.