ZMQDevice::__construct() expects exactly 2 parameters, 3 given #43

markkimsal opened this Issue Nov 5, 2011 · 6 comments

4 participants


Running the PHP example "msgqueue.php" from the zguide repo results in a warning and a segfault.

PHP Warning: ZMQDevice::__construct() expects exactly 2 parameters, 3 given in ./zguide/examples/PHP/msgqueue.php on line 20
Segmentation fault

Not sure why ZMQDevice::__construct() expects only 2 parameters. It doesn't look that way looking at zmq.c, not sure how to suggest a fix.



please take a look at the ChangeLog for 1.x version:

"the constructor now takes two arguments, front
and back socket. Starting the device has been moved to separate run method and
two new methods setIdleTimeout and setIdleCallback has been added."

Most likely the examples have not been updated yet. I think updating the guide is on Ian's todo list

@mkoppanen mkoppanen closed this Nov 5, 2011

Seems like the function prototype documentation claims 3 params (type, frontend, backend).

/* {{{ proto void ZMQDevice::__construct(int type, ZMQSocket frontend, ZMQSocket backend)
Construct a device

Is the type planned to be supported or was it supported and is being taken out?


It was supported but was taken out. The prototype should be fixed now.


@ianbarber Any chance of fixing the example? So there's no way to create a FORWARDER or STREAMER device--you always get a QUEUE?


As mentioned in another issue these devices were identical. The parameter was really redundant.


Yeah, I'll fix the example in the guide to reflect.

@mkoppanen mkoppanen added a commit that referenced this issue May 20, 2012
@mkoppanen Added test for #43 516bd6f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment