Skip to content
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

Add php7 compatibility #2

Open
wants to merge 108 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
a935292
start to migrate for pass building on php 7
ichiriac Dec 26, 2015
35def1c
RETURN_RESOURCE -> RETVAL_OBJ & fix ZVAL_TO_* macro
ichiriac Dec 26, 2015
8f30318
ZEND_FETCH_RESOURCE2_NO_RETURN -> zend_fetch_resource2_ex
ichiriac Dec 26, 2015
83885e2
syntax
ichiriac Dec 26, 2015
ee164cb
remove MAKE_STD_ZVAL usage
ichiriac Dec 26, 2015
0a035bc
fix ZVAL_RESOURCE & removes all zend_list_addref
ichiriac Dec 26, 2015
3382072
fix Z_LVAL_PP -> Z_LVAL_P
ichiriac Dec 26, 2015
ebf1974
fixing ALLOC_INIT_ZVAL
ichiriac Dec 26, 2015
ae0c4dd
fix resources creation
ichiriac Dec 26, 2015
7b09a31
change args
ichiriac Dec 26, 2015
bed5505
various
ichiriac Dec 26, 2015
0664767
change RETVAL_RES to ZVAL_COPY_VALUE
ichiriac Dec 26, 2015
40f877c
change long to zend_long
ichiriac Dec 26, 2015
ebab874
replace streams with zvals
ichiriac Dec 26, 2015
e8f1fb9
fix the callback structure
ichiriac Dec 26, 2015
810164d
migrate signature of zend_fetch_resource2_ex
ichiriac Dec 26, 2015
45d4fe1
fixed zend_fetch_resource2_ex calls
ichiriac Dec 26, 2015
34b0d6d
convert char to zend_string
ichiriac Dec 26, 2015
bb3630f
fix warn
ichiriac Dec 26, 2015
0879599
start to migrate _php_bufferevent_t structure
ichiriac Dec 26, 2015
6c6f62f
usage of Z_RES_P
ichiriac Dec 26, 2015
0a152d8
fix notices + revert a zend_string usage
ichiriac Dec 26, 2015
53cdb70
fix inconsistent usage between zval and *zval
ichiriac Dec 30, 2015
4788918
Add docs
ichiriac Dec 30, 2015
5101626
add more infos
ichiriac Dec 30, 2015
d15950e
Update README.md
ichiriac Dec 30, 2015
d6bbade
Update README.md
ichiriac Dec 30, 2015
80bdb12
Update README.md
ichiriac Dec 30, 2015
680643e
fix memory leak && references counter
ichiriac Dec 31, 2015
bfb8db2
bugfix https://github.com/expressif/pecl-event-libevent/issues/1
ichiriac Jan 1, 2016
64d3da7
add travis pecl module
ichiriac Jan 3, 2016
093dfa6
add a travis file
ichiriac Jan 3, 2016
9b97472
add build status
ichiriac Jan 3, 2016
29823a5
add a generic test
ichiriac Jan 3, 2016
657ad92
add php 7.0.2 tests
ichiriac Jan 3, 2016
6ce6b02
test 7.0.1
ichiriac Jan 3, 2016
5938b7e
fix event dtor https://github.com/expressif/pecl-event-libevent/issues/2
ichiriac Jan 3, 2016
f147550
fix test
ichiriac Jan 3, 2016
ca3652c
add test for bug https://github.com/expressif/pecl-event-libevent/iss…
ichiriac Jan 3, 2016
45f5c02
use file input instead of STDIN
ichiriac Jan 3, 2016
c02d0dc
using a stream instead a file
ichiriac Jan 3, 2016
1577a70
add ssl support on builds
ichiriac Jan 3, 2016
d1e581b
ignore tests outputs
ichiriac Jan 3, 2016
dbe5f5c
force ssl + fix output on test 001
ichiriac Jan 3, 2016
b06a5ee
fix warn message from libevent
ichiriac Jan 3, 2016
0cf97b8
fix undef $event warning
ichiriac Jan 4, 2016
0215551
fix https://github.com/expressif/pecl-event-libevent/issues/3#issueco…
ichiriac Jan 9, 2016
b8576a1
fix output of test 3
ichiriac Jan 9, 2016
7f782df
fix test output
ichiriac Jan 9, 2016
f71ed97
fix syntax error
ichiriac Jan 9, 2016
1cbe499
fixed syntax error #4
Joungkyun Jan 25, 2016
b040d5a
change zend_list_delete to zend_list_close as guide on https://wiki.p…
Joungkyun Jan 25, 2016
a38b882
refix #3 travis-ci.org libevent003.phpt
Joungkyun Jan 25, 2016
cc0eb53
fixed memory leak for libevent001.phpt
Joungkyun Jan 26, 2016
72b742d
fiexed segfault #3 by other case
Joungkyun Jan 26, 2016
fef8215
missing efree at 72b742d
Joungkyun Jan 26, 2016
43e70b8
fixed leak on debug_mode=yes on event_base_new
Joungkyun Jan 26, 2016
768bc55
fixed undefined symbol safe_efree
Joungkyun Jan 26, 2016
3de4259
fixed wrong varibale type on php_error_docref
Joungkyun Jan 26, 2016
021ca5f
remove unsed code
Joungkyun Jan 26, 2016
bd3fcd3
fixed segfault when reousrce argument is not resource type or invalid…
Joungkyun Jan 26, 2016
f6b7a1e
fixed segfualt when call error callback after calling event_buffer_free
Joungkyun Jan 26, 2016
817b2fe
add EVBUFFER_CONNECTED constant for libevent2 linking
Joungkyun Jan 26, 2016
d4beb1b
fixed indent
Joungkyun Jan 26, 2016
4fa02bf
Merge pull request #5 from Joungkyun/master
ichiriac Jan 27, 2016
317c6c5
use php 7.0 for tests
ichiriac Jan 27, 2016
d92015d
remove regacy code
Joungkyun Jan 27, 2016
c910b81
fixed assert error of libevent001.phpt on enable_debug=yes at issue #6
Joungkyun Jan 28, 2016
6fb5622
fixed leak of libevent002.phpt at #6
Joungkyun Jan 28, 2016
68a7989
fixed #6 libevent003.phpt's leak on enable_debug=on and enable_zts=on
Joungkyun Jan 28, 2016
2774f09
update credit
Joungkyun Jan 28, 2016
7b3caec
Merge pull request #7 from Joungkyun/master
ichiriac Jan 28, 2016
d859002
Create libevent004.phpt
ichiriac Feb 24, 2016
a48491e
extra space
ichiriac Feb 24, 2016
3784a2b
try patch as suggested in https://github.com/expressif/pecl-event-lib…
ichiriac Apr 8, 2016
6887d83
remove old recursive trick in_free & free stream_id
ichiriac Apr 8, 2016
ac255b8
fix proposed patch at https://github.com/expressif/pecl-event-libeven…
ichiriac Apr 8, 2016
842d53b
add a new test
ichiriac Apr 9, 2016
9e72744
fix - descrease refcount instead of closing the base @ event & buffer…
ichiriac Apr 9, 2016
c52e993
https://github.com/expressif/pecl-event-libevent/issues/11 add a test…
ichiriac Mar 8, 2017
b27f218
fix output
ichiriac Mar 9, 2017
85d51c2
https://github.com/expressif/pecl-event-libevent/issues/14 reproduce …
ichiriac Mar 9, 2017
a4a0bf5
https://github.com/expressif/pecl-event-libevent/issues/14 use Z_RES_…
ichiriac Mar 9, 2017
6d4b59e
fix output
ichiriac Mar 9, 2017
f7ae0d0
add php tag
ichiriac Mar 9, 2017
031800b
fix output test
ichiriac Mar 9, 2017
1fc4ff3
https://github.com/expressif/pecl-event-libevent/issues/14 replace Z_…
ichiriac Mar 9, 2017
79b99a0
fix output / warn
ichiriac Mar 9, 2017
05900f3
fix https://github.com/expressif/pecl-event-libevent/issues/11 issue …
ichiriac Mar 9, 2017
169a036
Windows: add dependency on ext/sockets
Jan-E Mar 11, 2017
48bdb37
to reproduce the error
sm2017 Mar 12, 2017
71ed258
Merge pull request #16 from sm2017/patch-1
ichiriac Mar 12, 2017
2c45825
fix stream closing when calling event_free
ichiriac Mar 12, 2017
34f70c6
Avoid closing the stream on event destructor
ichiriac Mar 12, 2017
2a41881
Add --disable-libevent-sockets config option
Jan-E Mar 12, 2017
e81d9df
https://github.com/expressif/pecl-event-libevent/issues/11 - fix stre…
ichiriac Mar 12, 2017
0f53bbf
ouch, typo
ichiriac Mar 12, 2017
629b733
REmove --disable-libevent-sockets, check php_sockets directly
Jan-E Mar 12, 2017
a57970b
Merge pull request #15 from Jan-E/master
ichiriac Mar 12, 2017
9d3152b
Update README.md
ichiriac Mar 13, 2017
995728b
https://github.com/expressif/pecl-event-libevent/issues/19 add test
ichiriac Mar 24, 2017
6841fa2
https://github.com/expressif/pecl-event-libevent/issues/19 fix into t…
ichiriac Mar 24, 2017
74e5f5d
fix test
ichiriac Mar 24, 2017
aee7625
https://github.com/expressif/pecl-event-libevent/issues/19 test with …
ichiriac Mar 24, 2017
e42c9c5
https://github.com/expressif/pecl-event-libevent/issues/19 handle tim…
ichiriac Mar 24, 2017
5a726ce
handle exactly the same event_set as event_timer_set
ichiriac Mar 24, 2017
cca0066
fix the issue result in seg fault when the event_base_set() called
May 24, 2019
ce255e7
Merge pull request #26 from tracylyh123/libevent-ext-bugfix
ichiriac May 30, 2019
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
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/tests/*.diff
/tests/*.exp
/tests/*.log
/tests/*.out
/tests/*.sh
/tests/*.php
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "travis/pecl"]
path = travis/pecl
url = https://github.com/m6w6/travis-pecl.git
23 changes: 23 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# autogenerated file; do not edit
sudo: false
language: c

addons:
apt:
packages:
- php5-cli
- php-pear

env:
matrix:
- PHP=7.0 enable_debug=no enable_maintainer_zts=no with_openssl=yes
- PHP=7.0 enable_debug=yes enable_maintainer_zts=no with_openssl=yes
- PHP=7.0 enable_debug=no enable_maintainer_zts=yes with_openssl=yes
- PHP=7.0 enable_debug=yes enable_maintainer_zts=yes with_openssl=yes

before_script:
- make -f travis/pecl/Makefile php
- make -f travis/pecl/Makefile ext PECL=libevent

script:
- make -f travis/pecl/Makefile test
2 changes: 1 addition & 1 deletion CREDITS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Antony Dovgal, Arnaud Le Blanc
Antony Dovgal, Arnaud Le Blanc, Ioan Chiriac, JoungKyun Kim
126 changes: 126 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
Libevent bindings for PHP
=========================

[![Build Status](https://travis-ci.org/expressif/pecl-event-libevent.svg)](https://travis-ci.org/expressif/pecl-event-libevent)

Libevent is a library that provides a mechanism to execute a callback function when a specific event occurs on a file descriptor or after a timeout has been reached.

More information about Libevent can be found at » http://libevent.org/.

--
**NOTE :** This fork is the port of the module to [PHP7 / PHPNG](https://wiki.php.net/phpng-upgrading)


## Requirements

This extension requires [» libevent](http://libevent.org/) library. Minimal required version is 1.4.0.

## Installation

Information for installing this PECL extension may be found in the manual chapter titled [Installation of PECL extensions](http://php.net/manual/en/install.pecl.php). Additional information such as new releases, downloads, source files, maintainer information, and a CHANGELOG, can be located here: » http://pecl.php.net/package/libevent.

## Compile from sources

Pre-requisites (only for linux) :

```sh
sudo apt-get install php7.0-dev gcc make libevent-dev
```

Compile sources :

```sh
git clone https://github.com/expressif/pecl-event-libevent.git
cd pecl-event-libevent
phpize
./configure
make && sudo make install
```

## Predefined Constants

The constants below are defined by this extension, and will only be available when the extension has either been compiled into PHP or dynamically loaded at runtime.

* EV_TIMEOUT (integer)
* EV_READ (integer)
* EV_WRITE (integer)
* EV_SIGNAL (integer)
* EV_PERSIST (integer)
* EVLOOP_NONBLOCK (integer)
* EVLOOP_ONCE (integer)

## Examples

Example #1 polling STDIN using basic API

```php
<?php

function print_line($fd, $events, $arg)
{
static $max_requests = 0;

$max_requests++;

if ($max_requests == 10) {
// exit loop after 10 writes
event_base_loopexit($arg[1]);
}

// print the line
echo fgets($fd);
}

// create base and event
$base = event_base_new();
$event = event_new();

$fd = STDIN;

// set event flags
event_set($event, $fd, EV_READ | EV_PERSIST, "print_line", array($event, $base));
// set event base
event_base_set($event, $base);

// enable event
event_add($event);
// start event loop
event_base_loop($base);
```

Example #2 polling STDIN using buffered event API

```php
<?php

function print_line($buf, $arg)
{
static $max_requests;

$max_requests++;

if ($max_requests == 10) {
event_base_loopexit($arg);
}

// print the line
echo event_buffer_read($buf, 4096);
}

function error_func($buf, $what, $arg)
{
// handle errors
}

$base = event_base_new();
$eb = event_buffer_new(STDIN, "print_line", NULL, "error_func", $base);

event_buffer_base_set($eb, $base);
event_buffer_enable($eb, EV_READ);

event_base_loop($base);
```

## Credits

Antony Dovgal, Arnaud Le Blanc, Ioan Chiriac, JoungKyun KIm
7 changes: 7 additions & 0 deletions config.w32
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ if (PHP_LIBEVENT != "no") {
{
EXTENSION('libevent', 'libevent.c');
AC_DEFINE('HAVE_LIBEVENT', 1);
if (typeof(PHP_SOCKETS) != "undefined" && PHP_SOCKETS != "no") {
ADD_EXTENSION_DEP("libevent", "sockets");
ADD_FLAG("CFLAGS_LIBEVENT", ' /D HAVE_SOCKETS ');
MESSAGE("\tlibevent sockets support enabled");
} else {
MESSAGE("\tlibevent sockets support not enabled");
}
} else {
WARNING("libevent not enabled; libraries and headers not found");
}
Expand Down
Loading