zeromq / php-zmq

ZeroMQ for PHP
http://pecl.php.net/zmq
Other
549 stars 119 forks source link

PHP 7.3 compatibility #193

Open remicollet opened 5 years ago

remicollet commented 5 years ago

Build can be fix with pr #190 but is not enough as we encounter segfault during test suite

=====================================================================
PHP         : /opt/remi/php73/root/usr/bin/php 
PHP_SAPI    : cli
PHP_VERSION : 7.3.0RC3
ZEND_VERSION: 3.3.0-dev
PHP_OS      : Linux - Linux builder.remirepo.net 4.18.10-100.fc27.x86_64 #1 SMP Wed Sep 26 11:06:22 UTC 2018 x86_64
INI actual  : /dev/shm/BUILD/php73-php-pecl-zmq-1.1.3/NTS
More .INIs  :   
CWD         : /dev/shm/BUILD/php73-php-pecl-zmq-1.1.3/NTS
Extra dirs  : 
VALGRIND    : Not used
=====================================================================
TIME START 2018-10-12 05:42:34
=====================================================================
TEST 1/63 [tests/001-send.phpt]
========DIFF========
002+ 
002- string(12) "Hello world!"
003+ Termsig=11
========DONE========
FAIL Test send / recv [tests/001-send.phpt] 
TEST 2/63 [tests/002-test-binary.phpt]
========DIFF========
002+ zend_mm_heap corrupted
002- int(1580)
003- bool(true)
========DONE========
FAIL Test send / recv binary [tests/002-test-binary.phpt] 
PASS Test getting persistent id [tests/003-getpersistentid.phpt] 
PASS Test getting endpoints [tests/004-getendpoints.phpt] 
PASS Test forcing connect [tests/005-forceconnectarg.phpt] 
PASS Test getsockopt / setsockopt [tests/006-sockopt.phpt] 
TEST 7/63 [tests/007-addremovepoll.phpt]
========DIFF========
004+ 
005+ Termsig=11
004- array(1) {
005-   [0]=>
006-   resource(%d) of type (stream)
007- }
008- array(1) {
009-   [0]=>
010-   resource(%d) of type (stream)
011- }
012- int(1)
013- array(1) {
014-   [0]=>
015-   string(3) "r:%d"
016- }
017- int(0)
========DONE========
FAIL Test adding / removing items [tests/007-addremovepoll.phpt] 
PASS Test constructing a socket [tests/008-twowaystoconstruct.phpt] 
PASS Test ispersistent on context and socket [tests/009-ispersistent.phpt] 
PASS Test invalid args for ZMQPoll [tests/010-pollsetinvalidargs.phpt] 
PASS Test exceptions [tests/011-exceptions.phpt] 
PASS Test remove invalid id from ZMQPoll [tests/012-pollsetremoveinvalid.phpt] 
PASS Test clearing and reusing ZMQPoll [tests/013-pollclearandreuse.phpt] 
PASS Test setSockOpt param type [tests/014-setsockoptparam.phpt] 
PASS Test basic callback usage [tests/015-callback.phpt] 
PASS Test invalid args for callback [tests/016-callbackinvalidargs.phpt] 
PASS Test that callback is only called on new socket [tests/017-callbackonlyonnewsocket.phpt] 
PASS Test callback arguments on persistent and non-persistent socket [tests/018-callbackpersistent.phpt] 
PASS Test throwing exception from callback [tests/020-exceptionincallback.phpt] 
TEST 20/63 [tests/021-callbackwarning.phpt]
========DIFF========
001+ Warning: in_array() expects parameter 2 to be array, int given in /dev/shm/BUILD/php73-php-pecl-zmq-1.1.3/NTS/tests/021-callbackwarning.php on line 5
001- Warning: in_array() expects parameter 2 to be array, integer given in %s on line %d
========DONE========
FAIL Test warning in callback [tests/021-callbackwarning.phpt] 
TEST 21/63 [tests/022-highwatermark.phpt]
========DIFF========
001+ 
001- array(1) {
002-   [0]=>
003-   object(ZMQSocket)#3 (0) {
004-   }
005- }
006- array(0) {
007- }
008- array(1) {
009-   [0]=>
010-   object(ZMQSocket)#3 (0) {
011-   }
012- }
013- OK
========DONE========
FAIL Test that high-watermark works [tests/022-highwatermark.phpt] 
PASS Test that failing callback does not add socket to plist [tests/023-failedcallback.phpt] 
PASS Test retrieving version [tests/024-versionconstant.phpt] 
PASS Test send / recv for multipart messages [tests/025-sendrecvmulti.phpt] 
PASS Test returning socket type [tests/026-sockettype.phpt] 
PASS Test setting and getting values [tests/027-getset.phpt] 
TEST 27/63 [tests/028-xpub.phpt]
========DIFF========
001+ Termsig=11
001- string(3) "Hel"
002- string(12) "Hello world!"
========DONE========
FAIL Test send / recv with XPUB and XSUB sockets [tests/028-xpub.phpt] 
TEST 28/63 [tests/029-xrepxreqdevice.phpt]
========DIFF========
002+ zend_mm_heap corrupted
002- string(13) "Hello client!"
========DONE========
FAIL Test send / recv with an XREQ and XREP device [tests/029-xrepxreqdevice.phpt] 
SKIP Test send / recv with a manually created XREQ and XREP device [tests/030-xrepmanualqueue.phpt] reason: Only for in libzmq 3.3.0
PASS Test last endpoint [tests/031-lastendpoint.phpt] 
PASS Test context options [tests/032-contextopt.phpt] 
PASS Test disconnect [tests/033-disconnect.phpt] 
PASS Test unbind [tests/034-unbind.phpt] 
TEST 34/63 [tests/035-capture.phpt]
========DIFF========
003+ zend_mm_heap corrupted
003- Receiving from capture listener
004- string(13) "Hello backend"
005- OK
========DONE========
FAIL Test device capture [tests/035-capture.phpt] 
PASS Test device callbacks [tests/036-device.phpt] 
PASS Test device deprecated args [tests/037-device-deprecated.phpt] 
SKIP Test a ZMQCert can be constructed. [tests/038-cert-construct.phpt] reason: This test requires php-zmq to be compiled with --with-czmq (only CZMQ 2.x supported)
SKIP Test two ZMQCerts can be tested for equality. [tests/039-cert-equals.phpt] reason: This test requires php-zmq to be compiled with --with-czmq (only CZMQ 2.x supported)
SKIP Test a ZMQCert can be cloned. [tests/040-cert-clone.phpt] reason: This test requires php-zmq to be compiled with --with-czmq (only CZMQ 2.x supported)
SKIP Test a ZMQCert can get and set metadata. [tests/041-cert-meta.phpt] reason: This test requires php-zmq to be compiled with --with-czmq (only CZMQ 2.x supported)
SKIP Test a ZMQCert can be saved. [tests/042-cert-save.phpt] reason: This test requires php-zmq to be compiled with --with-czmq (only CZMQ 2.x supported)
SKIP Test a ZMQCert can be loaded. [tests/043-cert-load.phpt] reason: This test requires php-zmq to be compiled with --with-czmq (only CZMQ 2.x supported)
SKIP Test a ZMQAuth can be constructed. [tests/044-auth-construct.phpt] reason: This test requires php-zmq to be compiled with --with-czmq (only CZMQ 2.x supported)
SKIP Test a ZMQAuth can whitelist or blacklist an IP address. [tests/045-auth-allow-deny.phpt] reason: This test requires php-zmq to be compiled with --with-czmq (only CZMQ 2.x supported)
SKIP Test a ZMQCert can be applied to a ZMQSocket. [tests/046-cert-apply.phpt] reason: This test requires php-zmq to be compiled with --with-czmq (only CZMQ 2.x supported)
SKIP Test a ZMQAuth can be configured. [tests/047-auth-configure.phpt] reason: This test requires php-zmq to be compiled with --with-czmq (only CZMQ 2.x supported)
PASS Test pollset items [tests/048-pollsetitems.phpt] 
TEST 48/63 [tests/049-events.phpt]
========DIFF========
010+ zend_mm_heap corrupted
010- array(3) {
011-   ["event"]=>
012-   int(1)
013-   ["value"]=>
014-   int(%d)
015-   ["address"]=>
016-   string(20) "tcp://127.0.0.1:5050"
017- }
018- bool(true)
019- OK
========DONE========
FAIL Test events [tests/049-events.phpt] 
TEST 49/63 [tests/050-sharedcontext.phpt]
========DIFF========
002+ zend_mm_heap corrupted
002- bool(true)
003- int(2)
004- OK
========DONE========
FAIL Test shared context [tests/050-sharedcontext.phpt] 
PASS Test socket count variations [tests/051-socketcount.phpt] 
SKIP Test pthreads integration [tests/052-pthreads.phpt] reason: Requires pthreads extension
PASS Test z85 [tests/053-z85.phpt] 
PASS Test curve keypair [tests/054-curvekeypair.phpt] 
PASS Test for GitHub issue 156 (https://github.com/mkoppanen/php-zmq/issues/156) [tests/bug_gh_156.phpt] 
PASS Test for Github issue #165 [tests/bug_gh_165.phpt] 
PASS Test for Github issue #43 [tests/bug_gh_43.phpt] 
TEST 57/63 [tests/bug_gh_49.phpt]
========DIFF========
001+ Termsig=11
001- client to server msg:0
002- server to client msg:1
003- client to server msg:2
004- server to client msg:3
005- client to server msg:4
006- server to client msg:5
007- client to server msg:6
008- server to client msg:7
009- client to server msg:8
010- server to client msg:9
========DONE========
FAIL Test for Github issue #49 [tests/bug_gh_49.phpt] 
TEST 58/63 [tests/bug_gh_50.phpt]
========DIFF========
001+ Termsig=11
001- bool(true)
002- array(2) {
003-   [0]=>
004-   object(ZMQSocket)#3 (0) {
005-   }
006-   [1]=>
007-   object(ZMQSocket)#4 (0) {
008-   }
009- }
010- array(0) {
011- }
012- bool(true)
013- array(1) {
014-   [0]=>
015-   object(ZMQSocket)#3 (0) {
016-   }
017- }
018- array(0) {
019- }
========DONE========
FAIL Test for Github issue #50 [tests/bug_gh_50.phpt] 
PASS Test for Github issue #59 [tests/bug_gh_59.phpt] 
PASS Test for Github issue #59 [tests/bug_gh_59_2.phpt] 
SKIP Test setting socket options [tests/libzmq2-sockopt.phpt] reason: This test is for PHP7 and libzmq version 2.x
SKIP Test setting socket options [tests/libzmq3-sockopt.phpt] reason: This test is for PHP7 and libzmq version 3.x
PASS Test setting socket options [tests/libzmq4-sockopt.phpt] 
=====================================================================
TIME END 2018-10-12 05:42:41

=====================================================================
TEST RESULT SUMMARY
---------------------------------------------------------------------
Exts skipped    :    0
Exts tested     :   15
---------------------------------------------------------------------

Number of tests :   63                49
Tests skipped   :   14 ( 22.2%) --------
Tests warned    :    0 (  0.0%) (  0.0%)
Tests failed    :   12 ( 19.0%) ( 24.5%)
Expected fail   :    0 (  0.0%) (  0.0%)
Tests passed    :   37 ( 58.7%) ( 75.5%)
---------------------------------------------------------------------
Time taken      :    7 seconds
=====================================================================

=====================================================================
FAILED TEST SUMMARY
---------------------------------------------------------------------
Test send / recv [tests/001-send.phpt]
Test send / recv binary [tests/002-test-binary.phpt]
Test adding / removing items [tests/007-addremovepoll.phpt]
Test warning in callback [tests/021-callbackwarning.phpt]
Test that high-watermark works [tests/022-highwatermark.phpt]
Test send / recv with XPUB and XSUB sockets [tests/028-xpub.phpt]
Test send / recv with an XREQ and XREP device [tests/029-xrepxreqdevice.phpt]
Test device capture [tests/035-capture.phpt]
Test events [tests/049-events.phpt]
Test shared context [tests/050-sharedcontext.phpt]
Test for Github issue #49 [tests/bug_gh_49.phpt]
Test for Github issue #50 [tests/bug_gh_50.phpt]
=====================================================================
arabcoders commented 5 years ago

zend_mm_heap corrupted still happens with the new release of PHP 7.3

ghost commented 5 years ago

Hello everyone,

Please check the commit ( https://github.com/alexat/php-zmq/commit/af02bde61c2a5af1ae64cac09ffe2b25237aa58e ) at my copy, I tried to do all the fixups required, and tests pass. Also fixes one long standing nasty bug with string initialization on recv() which could cause all sorts of issues.

arabcoders commented 5 years ago

@alexat thanks for the update, i dont really know how to build them for windows and linux so i hope project maintainer or @remicollet test them out xD

gregorg commented 5 years ago

Hi,

I have tested this version, compiling is OK, tests too, however I faced a curious bug that causes segfault on FPM processes. A strace shows a "getpid" function calls bombing. I'm not able to reproduce it in a sample code, and not able to isolate it. Too much problems, I'm going to migrate to IPC messages queue instead of ZMQ.

ghost commented 5 years ago

@gregorg Um, is perchance your PHP 7.3 build ZTS (have thread safety enabled)?

remicollet commented 5 years ago

@alexat segfault occurs on non-ZTS build (see output in first comment)

gregorg commented 5 years ago

@alexat I confirm, compiled without ZTS enabled.

remicollet commented 5 years ago

@alexat in fact, using your fork, test suite passes.

ghost commented 5 years ago

I have built myself a certain project development environment with PHP 7.3 / php-zmq patched for it, and started using it in one instead of PHP 7.0. For now, I don't have the aforementioned issue reported by @gregorg, on a ZMQ based centrale with 180+ nodes persistently connected and exchanging data via REQ/REP and PUB/SUB over TCP, so it at least works fine for me. Will continue testing it of course.

ghost commented 5 years ago

@gregorg So, for now I cannot exactly reproduce it. If you are able to somehow come with a failure reproduction script set, please mail me or create the issue @ my fork, I'll investigate.

oriceon commented 5 years ago

Hi there. I`m using ZQM on Windows and now with PHP 7.3 i receive an error.

zqm

There is any fix for that?

ghost commented 5 years ago

@oriceon You probably need to rebuild the php-zmq library for PHP 7.3 manually.

You can try (see the attachment) x64 NTS (no thread safety) or ZTS (thread safety) binaries I have just built against latest ZeroMQ 4.0.4 library release (you will need libzmq-v120-mt-4_0_4.dll to run these moudles) from the official ZeroMQ site.

But please keep in mind using such third party binaries is at best insecure and of course nothing is guaranteed to work correctly. I tested DLL with vanilla PHP 7.3.0 x64 release and it loads fine, no other tests were performed.

php-7.3.0-zmq-1.1.4-4.0.4-x64-vc15.zip

oriceon commented 5 years ago

@alexat thank you for your time. It`s loaded fine. Hope your pull request will be merged soon :)

ghost commented 5 years ago

@oriceon Given this repo is dead for 2+ years already, the chances are close to none. So I'll probably resort to maintainining it in my own tree with time, have some active/running/production projects that depend on it heavily and are not easily ported.

chasepeeler commented 5 years ago

In case anyone else makes it here and is having issues with an "Unable to load dynamic library 'php_zmq.dll'" message - don't rename libzmq-v120-mt-4_0_4.dll to libzmq.dll. Leave it named as-is.

@alexat Thank you very much for the 7.3 updates. I was able to compile it myself using your repository.

pezz commented 5 years ago

Just also wanted to thank @alexat - cheers mate.

andypost commented 5 years ago

Would be great to release new 2.x beta version to pecl

chasepeeler commented 5 years ago

@andypost as @alexat said in an earlier comment - unlikely. It appears this repo is dead.

@alexat - would you be willing to take over ownership of this extension? I'm sure @mkoppanen would be willing to give up control since they don't appear to be doing anything with it anymore.

vitozev commented 5 years ago

In the attached file, you'll find a compiled version of the library, working on the following environment:

PHP Version: 7.3.2 Compiler: MSVC15 (Visual C++ 2017) Architecture: x86 Thread safety (TS): enabled

How to install it?

  1. Ensure that you have the path to your PHP extensions (e.g. c:\xampp\php\ext) in your PATH environment variable.
  2. Extract the archive in ext directory.
  3. Restart Apache.

php-7.3.2-zmq-1.1.4-4.0.4-x86-vc15-ts.zip

oriceon commented 5 years ago

@kvitozev can you publish also a version for php 7.3.2 nts x64 ?!

And maybe steps to compile myself for later versions.

Thanks.

vitozev commented 5 years ago

Hi,

@alexat uploaded the following file in the same thread:

php-7.3.0-zmq-1.1.4-4.0.4-x64-vc15.zip

This doesn't work for you?

sergiorighi commented 5 years ago

I need to install it on php 7.3.9 on windows. Has anyone succeeded?

Thanks.

vitozev commented 5 years ago

@sergiorighi, what architecture - 32/64bit? If it's 64bit, you can try to use the .dll I attached few months ago.

bluca commented 5 years ago

@alexat we are looking for a new maintainer - see https://lists.zeromq.org/pipermail/zeromq-dev/2019-August/033109.html - are you interested?

sergiorighi commented 5 years ago

@kvitozev, is 64bit zts. I already tried that .dll, but it doesn't work at all. I tried with all possible versions and combinations.

ghost commented 5 years ago

@bluca I am actually interested and I have projects on php-zmq running, but alas, my current job eats almost all of my lifetime, so I surely won't become a decent maintainer, and project will still look lost. So this is a 'no', although I'll surely do some work on PHP 7.4 compatibility if needed when it's finally out.

PHP 7.4 also brings in a new C-wrapper API it seems, I wonder if it will be possible to wrap PHP ZMQ in it eventually. So this is an area to investigate, which I'll as well will touch eventually and share if it does some good.

bluca commented 5 years ago

@alexat we'd be happy to have someone that knows php and can review pull requests - we are not looking for a full time developer, just for someone qualified enough to press the "merge" button with some confidence :-)

kinosang commented 4 years ago

PHP Version: 7.4.4 0MQ Version: 4.3.2 Compiler: MSVC15 (Visual C++ 2017) Architecture: x64

Both ZTS & NTS

~php-7.4.4-zmq-1.1.4-4.3.2-x64-vc15-zts.zip~

php-7.4.4-zmq-1.1.4-4.3.2-x64-vc15-zts-nts.zip

oriceon commented 4 years ago

@kinosang can you publish nts also?

kinosang commented 4 years ago

@oriceon Here it is.

oriceon commented 4 years ago

Thanks

sunsuron commented 4 years ago

@kinosang

Thanks!

koswarabilly commented 4 years ago

Thanks!

sergiorighi commented 4 years ago

I'm having problems with php 7.4.7, apache exits with error Parent: child process exited with error code 3221225725. Without zmq it doesn't happen. Someone with the same problem?

koswarabilly commented 4 years ago

@sergiorighi I do not encounter that problem.

Plasmodino commented 4 years ago

I tried php-7.4.4-zmq-1.1.4-4.3.2-x64-vc15-zts-nts.zip:

While
$this->context = new ZMQContext(); $this->socket = new ZMQSocket($this->context, ZMQ::SOCKET_DEALER); works when executing it with php.exe.

But the line new ZMQSocket() crashes in Apache 2.4

Any idea what could be the reason?

ghost commented 4 years ago

Are you perchance using non-ZTS PHP&module with ZTS-requiring MPM like worker or event?

Plasmodino commented 4 years ago

I use php_zmq_zts.dll & libzmq-v141-mt-4_3_2.dll, zmq is listed in phpinfo() and php.exe -i

I can create the ZMQContext, but when the script is called in the browser, the script just terminates when a ZMQSocket is created. When I call the script with php.exe, it works.

sergiorighi commented 3 years ago

Have someone tested with php 8?

ghost commented 3 years ago

The latest trunk here has the isolation parameter fix, compiles and passes all the small test subset under released PHP 8.0. Have not done any application testing yet personally though.

andypost commented 3 years ago

As PHP 7.2 days are gone, it makes sense to rename the issue to 8.0

LorenzoS92 commented 3 years ago

Sorry about this - can i ask you why the're couple of merged MR with fixes about PHP 7.3 and PHP 8.0 compatibility, but the latest version of libzmq-php published on PECL dates back to 2016? Could someone publish a new compiled version on PECL or we've to manually compile everyone from the source code?

chasepeeler commented 3 years ago

Sorry about this - can i ask you why the're couple of merged MR with fixes about PHP 7.3 and PHP 8.0 compatibility, but the latest version of libzmq-php published on PECL dates back to 2016? Could someone publish a new compiled version on PECL or we've to manually compile everyone from the source code?

I was able to compile it myself against 7.3, but I'm having issues against 8.0. If anyone has a x64 nts version they could share, that would be awesome.

wradstok commented 3 years ago

I compiled zmq for PHP 8.0.2 x64 NTS. File(s) attached to this comment if they are useful to anyone else. Use at your own risk!

zmq_php8.0.2.zip

ceonello commented 3 years ago

I'm having problems with php 7.4.7, apache exits with error Parent: child process exited with error code 3221225725. Without zmq it doesn't happen. Someone with the same problem?

Same Problem here, PHP 7.4.13, Apache 2.4 on a Windows machine. Apache starts without any error but as soon as php call a zmq function, Apache crash with code 3221225725

ghost commented 3 years ago

I'm not exactly versed in Windows builds, but please check if the extension, PHP and Apache are built using the same VC version & for the same VC runtime version.

ceonello commented 3 years ago

I'm not exactly versed in Windows builds, but please check if the extension, PHP and Apache are built using the same VC version & for the same VC runtime version.

@alexat , thanks for the response. I checked and extension, PHP and Apache are all built with VC15 x64. That not seem to be the problem

Plasmodino commented 3 years ago

I was not able to run zmq in php 7.4 either when php was run as an apache module:

LoadModule php7_module C:/PHP70_TS/php7apache2_4.dll (TS)

It worked in my case with fcgid, though:

LoadModule fcgid_module modules/mod_fcgid.so (NTS)

Using zmq in php.exe also worked.

nop1984 commented 3 years ago

@wradstok https://github.com/zeromq/php-zmq/issues/193#issuecomment-779032545 is working Win10 php 8.0.10 without apache

@kinosang https://github.com/zeromq/php-zmq/issues/193#issuecomment-605456811 is working Win 10 php 7.4.9 under Apache2 under WAMP (as CGI and as Apache module)

Thanks, both!

For those who may come here from struggling with WAMP:

Lukaum commented 3 years ago

Don't have a second way to subistitute zmq (only for this push purpose)?

Somebody already tested in a online host?