php-zmq icon indicating copy to clipboard operation
php-zmq copied to clipboard

PHP 7.3 compatibility

Open remicollet opened this issue 6 years ago • 62 comments

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]
=====================================================================

remicollet avatar Oct 12 '18 05:10 remicollet

zend_mm_heap corrupted still happens with the new release of PHP 7.3

arabcoders avatar Dec 07 '18 09:12 arabcoders

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.

ghost avatar Dec 10 '18 20:12 ghost

@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

arabcoders avatar Dec 13 '18 12:12 arabcoders

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.

gregorg avatar Dec 13 '18 12:12 gregorg

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

ghost avatar Dec 13 '18 17:12 ghost

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

remicollet avatar Dec 14 '18 09:12 remicollet

@alexat I confirm, compiled without ZTS enabled.

gregorg avatar Dec 14 '18 09:12 gregorg

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

remicollet avatar Dec 14 '18 10:12 remicollet

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 avatar Dec 14 '18 11:12 ghost

@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.

ghost avatar Dec 14 '18 11:12 ghost

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?

oriceon avatar Dec 27 '18 10:12 oriceon

@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

ghost avatar Dec 28 '18 06:12 ghost

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

oriceon avatar Dec 28 '18 07:12 oriceon

@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.

ghost avatar Dec 28 '18 07:12 ghost

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.

chasepeeler avatar Jan 29 '19 17:01 chasepeeler

Just also wanted to thank @alexat - cheers mate.

pezz avatar Feb 19 '19 22:02 pezz

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

andypost avatar Apr 11 '19 19:04 andypost

@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.

chasepeeler avatar Apr 11 '19 19:04 chasepeeler

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

vitozev avatar Jun 20 '19 10:06 vitozev

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

And maybe steps to compile myself for later versions.

Thanks.

oriceon avatar Jul 04 '19 09:07 oriceon

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?

vitozev avatar Jul 04 '19 10:07 vitozev

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

Thanks.

sergiorighi avatar Sep 10 '19 12:09 sergiorighi

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

vitozev avatar Sep 10 '19 13:09 vitozev

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

bluca avatar Sep 10 '19 13:09 bluca

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

sergiorighi avatar Sep 10 '19 14:09 sergiorighi

@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.

ghost avatar Sep 10 '19 16:09 ghost

@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 :-)

bluca avatar Sep 10 '19 16:09 bluca

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

kinosang avatar Mar 28 '20 14:03 kinosang

@kinosang can you publish nts also?

oriceon avatar Mar 28 '20 16:03 oriceon

@oriceon Here it is.

kinosang avatar Mar 28 '20 18:03 kinosang