Code Monkey home page Code Monkey logo

mosquitto-php's Introduction

Mosquitto-PHP

This is an extension to allow using the Eclipse Mosquitto™ MQTT client library with PHP. See the examples/ directory for usage.

Build Status

PHP 7 support

Thanks to Sara Golemon this extension now supports PHP 7. I would be grateful if anyone using PHP 7 could test it and let me know how it works out.

Requirements

  • PHP 5.3+
  • libmosquitto 1.2.x or later
  • Linux or Mac OS X. I do not have a Windows machine handy, though patches or pull requests are of course very welcome!

Installation

If you've used a pre-built package to install Mosquitto, you need to make sure you have the development headers installed. On Red Hat-derived systems, this is probably called libmosquitto-devel, and on Debian-based systems it will be libmosquitto-dev.

You may obtain this package using PECL:

pecl install Mosquitto-alpha

Alternatively, you can use the normal extension build process:

phpize
./configure --with-mosquitto=/path/to/libmosquitto
make
make install

Then add extension=mosquitto.so to your php.ini.

The --with-mosquitto argument is optional, and only required if your libmosquitto install cannot be found.

General operation

The underlying library is based on callbacks and asynchronous operation. As such, you have to call the loop() method of the Client frequently to permit the library to handle the messages in its queues. Also, you should use the callback functions to ensure that you only attempt to publish after the client has connected, etc. For example, here is how you would correctly publish a QoS=2 message:

<?php

use Mosquitto\Client;

$mid = 0;
$c = new Mosquitto\Client("PHP");
$c->onLog('var_dump');
$c->onConnect(function() use ($c, &$mid) {
    $mid = $c->publish("mgdm/test", "Hello", 2);
});

$c->onPublish(function($publishedId) use ($c, $mid) {
    if ($publishedId == $mid) {
        $c->disconnect();
    }
});

$c->connect("localhost");
$c->loopForever();

echo "Finished"

Documentation

Full documentation is available on ReadTheDocs.

mosquitto-php's People

Contributors

argakon avatar imacrayon avatar mgdm avatar remicollet avatar sgolemon avatar tysonandre avatar weltling avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mosquitto-php's Issues

SSL3_READ_BYTES:tlsv1 alert protocol version

I get this error using the same ca that all my devices connect to the broker with.

1471171616: OpenSSL Error: error:1409442E:SSL routines:SSL3_READ_BYTES:tlsv1 alert protocol version
1471171616: OpenSSL Error: error:140940E5:SSL routines:SSL3_READ_BYTES:ssl handshake failure
1471171616: Socket error on client <unknown>, disconnecting.

wont execute PHP from web but will do so from command line

When i execute the code from the command line the message is sent correctly, but when i call the same code from a browser i get "http error 500".

  • PHP 5.6.27-0+deb8u1 (cli) (built: Oct 15 2016 15:53:28)
  • mosquitto version 1.4.10 (build date Thu, 25 Aug 2016 10:12:09 +0100)
  • php.ini includes: extension=mosquitto.so
  • php -m shows mosquitto is loaded
  • nginx/1.6.2
  • nginx error log ==> FastCGI sent in stderr: "PHP Fatal error: Class 'Mosquitto\Client' not found in /var/www/html/mqttTest.php on line 7" while reading response header from upstream, client: {ipaddress-here}, s$

PHP Code:

setCredentials($username, $password); $client->connect($server, $port, 60); $message = "test msg"; $client->publish($topic, $message, 1); $client->disconnect(); } catch (Exception $e) { echo $e; } ?>

Problem publishing with QOS = 2

Hi ,

I`m trying to publish on a queue using QOS 2 , with no luck so far.

Using :
PHP 5.5.9-1ubuntu4.9 (cli) (built: Apr 17 2015 11:44:57)
libmosquitto version 1.2.3
Extension version : 0.2.2
mosquitto version 1.4.2 (build date 2015-05-25 18:51:47+0300)

Code:

   $mqtt_client = new Mosquitto\Client();
   $mqtt_client->connect('192.168.0.50', 1883, 5);
   $mid = $mqtt_client->publish('/2/orders', 'TEST' , 2 , false  );   
   $mqtt_client->disconnect();

If I change the qos value to 0 or 1 , it works flawlessly. Ive tested all scenarios qos 2 does not work, the output is below. (as a side note : Ive tested this code with HiveMQ as well. Ver 1.5 works, but starting with ver 2, it fails as well).

Debug log from mosquitto :

1432571507: New connection from 192.168.0.112 on port 1883.
1432571507: Client lens_kPWHtQiFUMTz2h4fbBfma4gxR0p already connected, closing old connection.
1432571507: Client lens_kPWHtQiFUMTz2h4fbBfma4gxR0p disconnected.
1432571507: New client connected from 192.168.0.112 as lens_kPWHtQiFUMTz2h4fbBfma4gxR0p (c1, k120).
1432571507: Sending CONNACK to lens_kPWHtQiFUMTz2h4fbBfma4gxR0p (0, 0)
1432571515: Received SUBSCRIBE from lens_kPWHtQiFUMTz2h4fbBfma4gxR0p
1432571515:     # (QoS 0)
1432571515: lens_kPWHtQiFUMTz2h4fbBfma4gxR0p 0 #
1432571515: Sending SUBACK to lens_kPWHtQiFUMTz2h4fbBfma4gxR0p
1432571527: New connection from 192.168.0.29 on port 1883.
1432571527: New client connected from 192.168.0.29 as mosq/vtPkkP@`EJ]WH5fh\E (c1, k5).
1432571527: Sending CONNACK to mosq/vtPkkP@`EJ]WH5fh\E (0, 0)
1432571527: Received PUBLISH from mosq/vtPkkP@`EJ]WH5fh\E (d0, q2, r0, m1, '/2/jeg', ... (4 bytes))
1432571527: Sending PUBREC to mosq/vtPkkP@`EJ]WH5fh\E (Mid: 1)
1432571529: Received DISCONNECT from mosq/vtPkkP@`EJ]WH5fh\E
1432571529: Client mosq/vtPkkP@`EJ]WH5fh\E disconnected.
1432571555: New connection from 192.168.0.29 on port 1883.
1432571555: New client connected from 192.168.0.29 as mosq/EiEjh;8c\ssqA3Nu_Q (c1, k5).
1432571555: Sending CONNACK to mosq/EiEjh;8c\ssqA3Nu_Q (0, 0)
1432571555: Received PUBLISH from mosq/EiEjh;8c\ssqA3Nu_Q (d0, q1, r0, m1, '/2/jeg', ... (4 bytes))
1432571555: Sending PUBACK to mosq/EiEjh;8c\ssqA3Nu_Q (Mid: 1)
1432571555: Sending PUBLISH to lens_kPWHtQiFUMTz2h4fbBfma4gxR0p (d0, q0, r0, m0, '/2/jeg', ... (4 bytes))
1432571557: Received DISCONNECT from mosq/EiEjh;8c\ssqA3Nu_Q
1432571557: Client mosq/EiEjh;8c\ssqA3Nu_Q disconnected.
1432571576: New connection from 192.168.0.29 on port 1883.
1432571576: New client connected from 192.168.0.29 as mosq/`JSMd1Yi0Ag_>S6iEG (c1, k5).
1432571576: Sending CONNACK to mosq/`JSMd1Yi0Ag_>S6iEG (0, 0)
1432571576: Received PUBLISH from mosq/`JSMd1Yi0Ag_>S6iEG (d0, q1, r1, m1, '/2/jeg', ... (4 bytes))
1432571576: Sending PUBACK to mosq/`JSMd1Yi0Ag_>S6iEG (Mid: 1)
1432571576: Sending PUBLISH to lens_kPWHtQiFUMTz2h4fbBfma4gxR0p (d0, q0, r0, m0, '/2/jeg', ... (4 bytes))
1432571578: Received DISCONNECT from mosq/`JSMd1Yi0Ag_>S6iEG
1432571578: Client mosq/`JSMd1Yi0Ag_>S6iEG disconnected.
1432571594: New connection from 192.168.0.29 on port 1883.
1432571594: New client connected from 192.168.0.29 as mosq/_aErGr<8WU]@^Iw:^S (c1, k5).
1432571594: Sending CONNACK to mosq/_aErGr<8WU]@^Iw:^S (0, 0)
1432571594: Received PUBLISH from mosq/_aErGr<8WU]@^Iw:^S (d0, q1, r1, m1, '/2/jeg', ... (4 bytes))
1432571594: Sending PUBACK to mosq/_aErGr<8WU]@^Iw:^S (Mid: 1)
1432571594: Sending PUBLISH to lens_kPWHtQiFUMTz2h4fbBfma4gxR0p (d0, q0, r0, m0, '/2/jeg', ... (4 bytes))
1432571596: Received DISCONNECT from mosq/_aErGr<8WU]@^Iw:^S
1432571596: Client mosq/_aErGr<8WU]@^Iw:^S disconnected.

zend_mm_head with PHP - ZTS

Hello

if i complie php with the option --enable-maintainer-zts, the Mosquitto-PHP Module is not working.
all Mosquitto-PHP test fails.


=====================================================================
PHP         : /usr/local/php/bin/php 
PHP_SAPI    : cli
PHP_VERSION : 7.1.1
ZEND_VERSION: 3.1.0
PHP_OS      : Linux - Linux myhost 4.4.38-v7+ #938 SMP Thu Dec 15 15:22:21 GMT 2016 armv7l
INI actual  : /home/pi/var/Mosquitto-PHP/tmp-php.ini
More .INIs  :   
.....

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

Number of tests :   29                29
Tests skipped   :    0 (  0.0%) --------
Tests warned    :    0 (  0.0%) (  0.0%)
Tests failed    :   26 ( 89.7%) ( 89.7%)
Expected fail   :    0 (  0.0%) (  0.0%)
Tests passed    :    3 ( 10.3%) ( 10.3%)
---------------------------------------------------------------------
Time taken      :   11 seconds
=====================================================================

I get a "zend_mm_head corrupted" message if I run the test manually.

~/var/Mosquitto-PHP/tests$ php Client/__construct.php
object(Mosquitto\Client)#1 (0) {
}
zend_mm_heap corrupted

~/var/Mosquitto-PHP$ export USE_ZEND_ALLOC=0
~/var/Mosquitto-PHP$ php tests/Client/clearWill.php
Caught Mosquitto\Exception with code 0 and message: Mosquitto\Client::clearWill() expects exactly 0 parameters, 1 given
*** Error in `php': free(): invalid pointer: 0x76689714 ***
Aborted

PHP without ZTS work fine.

Throwing an exception instead of reconnecting

As I tested reconnecting by using loopForever() and restarting the local mqtt-broker mosquitto, my script stops. The output was:

PHP Fatal error: Uncaught exception 'Mosquitto\Exception' with message 'The connection was lost.' in /home/user/public_html/test.php:41
Stack trace:

0 /home/user/public_html/test.php(41): Mosquitto\Client->loopForever()

1 {main}

thrown in /home/user/public_html/test.php on line 41

I expected a reconnect, but this wasn't the case. Whats wrong here?

Error installing - pecl install Mosquitto-alpha

Hi,

I followed the instructions on an Ubuntu 16.04.1 LTS Linod with PHP 7.0.8-0ubuntu0.16.04.2.
Before running the "pecl" command I did this:

sudo apt-get install python-software-properties
sudo apt-get install software-properties-common
sudo apt-get install php7.0-dev
sudo apt-get install mosquitto
sudo apt install mosquitto-clients
sudo apt-get install libmosquitto-dev

When I now run pecl install Mosquitto-alpha, the installation breaks with the following log.
Could you help me decipher it?

downloading Mosquitto-0.3.0.tgz ...
Starting to download Mosquitto-0.3.0.tgz (25,395 bytes)
.........done: 25,395 bytes
5 source files, building
running: phpize
Configuring for:
PHP Api Version: 20151012
Zend Module Api No: 20151012
Zend Extension Api No: 320151012
Please provide the prefix of the libmosquitto installation [autodetect] :
building in /tmp/pear/temp/pear-build-rootYRXIyR/Mosquitto-0.3.0
running: /tmp/pear/temp/Mosquitto/configure --with-php-config=/usr/bin/php-config --with-mosquitto
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php/20151012 -I/usr/include/php/20151012/main -I/usr/include/php/20151012/TSRM -I/usr/include/php/20151012/Zend -I/usr/include/php/20151012/ext -I/usr/include/php/20151012/ext/date/lib
checking for PHP extension directory... /usr/lib/php/20151012
checking for PHP installed headers prefix... /usr/include/php/20151012
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... re2c
checking for re2c version... 0.16 (ok)
checking for gawk... gawk
checking for mosquitto support... yes, shared
checking for mosquitto files in default path... checking /usr/local... found in /usr/local
checking /usr... found in /usr
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking whether strerror_r is declared... yes
checking for strerror_r... yes
checking whether strerror_r returns char _... no
checking how to print strings... printf
checking for a sed that does not truncate output... (cached) /bin/sed
checking for fgrep... /bin/grep -F
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @file support... @
checking for strip... strip
checking for ranlib... ranlib
checking for gawk... (cached) gawk
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... mt
checking if mt is a manifest tool... no
checking for dlfcn.h... yes
checking for objdir... .libs
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC -DPIC
checking if cc PIC flag -fPIC -DPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking if cc supports -c -o file.o... (cached) yes
checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
configure: creating ./config.status
config.status: creating config.h
config.status: executing libtool commands
running: make
/bin/bash /tmp/pear/temp/pear-build-rootYRXIyR/Mosquitto-0.3.0/libtool --mode=compile cc -I. -I/tmp/pear/temp/Mosquitto -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootYRXIyR/Mosquitto-0.3.0/include -I/tmp/pear/temp/pear-build-rootYRXIyR/Mosquitto-0.3.0/main -I/tmp/pear/temp/Mosquitto -I/usr/include/php/20151012 -I/usr/include/php/20151012/main -I/usr/include/php/20151012/TSRM -I/usr/include/php/20151012/Zend -I/usr/include/php/20151012/ext -I/usr/include/php/20151012/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/Mosquitto/mosquitto.c -o mosquitto.lo
libtool: compile: cc -I. -I/tmp/pear/temp/Mosquitto -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootYRXIyR/Mosquitto-0.3.0/include -I/tmp/pear/temp/pear-build-rootYRXIyR/Mosquitto-0.3.0/main -I/tmp/pear/temp/Mosquitto -I/usr/include/php/20151012 -I/usr/include/php/20151012/main -I/usr/include/php/20151012/TSRM -I/usr/include/php/20151012/Zend -I/usr/include/php/20151012/ext -I/usr/include/php/20151012/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/Mosquitto/mosquitto.c -fPIC -DPIC -o .libs/mosquitto.o
/tmp/pear/temp/Mosquitto/mosquitto.c: In function ‘zim_Mosquitto_Client___construct’:
/tmp/pear/temp/Mosquitto/mosquitto.c:114:39: warning: implicit declaration of function ‘zend_object_store_get_object’ [-Wimplicit-function-declaration]
object = (mosquitto_client_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
^
/tmp/pear/temp/Mosquitto/mosquitto.c:114:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
object = (mosquitto_client_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
^
/tmp/pear/temp/Mosquitto/mosquitto.c: In function ‘zim_Mosquitto_Client_setTlsCertificates’:
/tmp/pear/temp/Mosquitto/mosquitto.c:159:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
object = (mosquitto_client_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
^
/tmp/pear/temp/Mosquitto/mosquitto.c:162:11: warning: implicit declaration of function ‘Z_BVAL’ [-Wimplicit-function-declaration]
is_dir = Z_BVAL(stat);
^
/tmp/pear/temp/Mosquitto/mosquitto.c: In function ‘zim_Mosquitto_Client_setTlsInsecure’:
/tmp/pear/temp/Mosquitto/mosquitto.c:195:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
object = (mosquitto_client_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
^
/tmp/pear/temp/Mosquitto/mosquitto.c: In function ‘zim_Mosquitto_Client_setTlsOptions’:
/tmp/pear/temp/Mosquitto/mosquitto.c:222:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
object = (mosquitto_client_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
^
/tmp/pear/temp/Mosquitto/mosquitto.c: In function ‘zim_Mosquitto_Client_setTlsPSK’:
/tmp/pear/temp/Mosquitto/mosquitto.c:247:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
object = (mosquitto_client_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
^
In file included from /usr/include/php/20151012/Zend/zend.h:31:0,
from /usr/include/php/20151012/main/php.h:36,
from /tmp/pear/temp/Mosquitto/mosquitto.c:5:
/tmp/pear/temp/Mosquitto/mosquitto.c: In function ‘zim_Mosquitto_Client_onConnect’:
/tmp/pear/temp/Mosquitto/mosquitto.c:421:13: error: incompatible type for argument 1 of ‘zval_addref_p’
Z_ADDREF_P(connect_callback.function_name);
^
/usr/include/php/20151012/Zend/zend_types.h:787:41: note: in definition of macro ‘Z_ADDREF_P’
#define Z_ADDREF_P(pz) zval_addref_p(pz)
^
/usr/include/php/20151012/Zend/zend_types.h:820:36: note: expected ‘zval * {aka struct _zval_struct *}’ but argument is of type ‘zval {aka struct zval_struct}’
static zend_always_inline uint32_t zval_addref_p(zval
pz) {
^
/tmp/pear/temp/Mosquitto/mosquitto.c:423:22: error: ‘zend_fcall_info {aka struct _zend_fcall_info}’ has no member named ‘object_ptr’
if (connect_callback.object_ptr != NULL) {
^
In file included from /usr/include/php/20151012/Zend/zend.h:31:0,
from /usr/include/php/20151012/main/php.h:36,
from /tmp/pear/temp/Mosquitto/mosquitto.c:5:
/tmp/pear/temp/Mosquitto/mosquitto.c:424:30: error: ‘zend_fcall_info {aka struct _zend_fcall_info}’ has no member named ‘object_ptr’
Z_ADDREF_P(connect_callback.object_ptr);
^
/usr/include/php/20151012/Zend/zend_types.h:787:41: note: in definition of macro ‘Z_ADDREF_P’
#define Z_ADDREF_P(pz) zval_addref_p(pz)
^
/tmp/pear/temp/Mosquitto/mosquitto.c: In function ‘zim_Mosquitto_Client_onDisconnect’:
/tmp/pear/temp/Mosquitto/mosquitto.c:455:13: error: incompatible type for argument 1 of ‘zval_addref_p’
Z_ADDREF_P(disconnect_callback.function_name);
^
/usr/include/php/20151012/Zend/zend_types.h:787:41: note: in definition of macro ‘Z_ADDREF_P’
#define Z_ADDREF_P(pz) zval_addref_p(pz)
^
/usr/include/php/20151012/Zend/zend_types.h:820:36: note: expected ‘zval * {aka struct _zval_struct _}’ but argument is of type ‘zval {aka struct zval_struct}’
static zend_always_inline uint32_t zval_addref_p(zval
pz) {
^
/tmp/pear/temp/Mosquitto/mosquitto.c:457:25: error: ‘zend_fcall_info {aka struct _zend_fcall_info}’ has no member named ‘object_ptr’
if (disconnect_callback.object_ptr != NULL) {
^
In file included from /usr/include/php/20151012/Zend/zend.h:31:0,
from /usr/include/php/20151012/main/php.h:36,
from /tmp/pear/temp/Mosquitto/mosquitto.c:5:
/tmp/pear/temp/Mosquitto/mosquitto.c:458:33: error: ‘zend_fcall_info {aka struct _zend_fcall_info}’ has no member named ‘object_ptr’
Z_ADDREF_P(disconnect_callback.object_ptr);
^
/usr/include/php/20151012/Zend/zend_types.h:787:41: note: in definition of macro ‘Z_ADDREF_P’
#define Z_ADDREF_P(pz) zval_addref_p(pz)
^
/tmp/pear/temp/Mosquitto/mosquitto.c: In function ‘zim_Mosquitto_Client_onLog’:
/tmp/pear/temp/Mosquitto/mosquitto.c:489:13: error: incompatible type for argument 1 of ‘zval_addref_p’
Z_ADDREF_P(log_callback.function_name);
^
/usr/include/php/20151012/Zend/zend_types.h:787:41: note: in definition of macro ‘Z_ADDREF_P’
#define Z_ADDREF_P(pz) zval_addref_p(pz)
^
/usr/include/php/20151012/Zend/zend_types.h:820:36: note: expected ‘zval * {aka struct _zval_struct _}’ but argument is of type ‘zval {aka struct zval_struct}’
static zend_always_inline uint32_t zval_addref_p(zval
pz) {
^
/tmp/pear/temp/Mosquitto/mosquitto.c:491:18: error: ‘zend_fcall_info {aka struct _zend_fcall_info}’ has no member named ‘object_ptr’
if (log_callback.object_ptr != NULL) {
^
In file included from /usr/include/php/20151012/Zend/zend.h:31:0,
from /usr/include/php/20151012/main/php.h:36,
from /tmp/pear/temp/Mosquitto/mosquitto.c:5:
/tmp/pear/temp/Mosquitto/mosquitto.c:492:26: error: ‘zend_fcall_info {aka struct _zend_fcall_info}’ has no member named ‘object_ptr’
Z_ADDREF_P(log_callback.object_ptr);
^
/usr/include/php/20151012/Zend/zend_types.h:787:41: note: in definition of macro ‘Z_ADDREF_P’
#define Z_ADDREF_P(pz) zval_addref_p(pz)
^
/tmp/pear/temp/Mosquitto/mosquitto.c: In function ‘zim_Mosquitto_Client_onSubscribe’:
/tmp/pear/temp/Mosquitto/mosquitto.c:523:13: error: incompatible type for argument 1 of ‘zval_addref_p’
Z_ADDREF_P(subscribe_callback.function_name);
^
/usr/include/php/20151012/Zend/zend_types.h:787:41: note: in definition of macro ‘Z_ADDREF_P’
#define Z_ADDREF_P(pz) zval_addref_p(pz)
^
/usr/include/php/20151012/Zend/zend_types.h:820:36: note: expected ‘zval * {aka struct _zval_struct _}’ but argument is of type ‘zval {aka struct zval_struct}’
static zend_always_inline uint32_t zval_addref_p(zval
pz) {
^
/tmp/pear/temp/Mosquitto/mosquitto.c:525:24: error: ‘zend_fcall_info {aka struct _zend_fcall_info}’ has no member named ‘object_ptr’
if (subscribe_callback.object_ptr != NULL) {
^
In file included from /usr/include/php/20151012/Zend/zend.h:31:0,
from /usr/include/php/20151012/main/php.h:36,
from /tmp/pear/temp/Mosquitto/mosquitto.c:5:
/tmp/pear/temp/Mosquitto/mosquitto.c:526:32: error: ‘zend_fcall_info {aka struct _zend_fcall_info}’ has no member named ‘object_ptr’
Z_ADDREF_P(subscribe_callback.object_ptr);
^
/usr/include/php/20151012/Zend/zend_types.h:787:41: note: in definition of macro ‘Z_ADDREF_P’
#define Z_ADDREF_P(pz) zval_addref_p(pz)
^
/tmp/pear/temp/Mosquitto/mosquitto.c: In function ‘zim_Mosquitto_Client_onUnsubscribe’:
/tmp/pear/temp/Mosquitto/mosquitto.c:557:13: error: incompatible type for argument 1 of ‘zval_addref_p’
Z_ADDREF_P(unsubscribe_callback.function_name);
^
/usr/include/php/20151012/Zend/zend_types.h:787:41: note: in definition of macro ‘Z_ADDREF_P’
#define Z_ADDREF_P(pz) zval_addref_p(pz)
^
/usr/include/php/20151012/Zend/zend_types.h:820:36: note: expected ‘zval * {aka struct _zval_struct _}’ but argument is of type ‘zval {aka struct zval_struct}’
static zend_always_inline uint32_t zval_addref_p(zval
pz) {
^
/tmp/pear/temp/Mosquitto/mosquitto.c:559:26: error: ‘zend_fcall_info {aka struct _zend_fcall_info}’ has no member named ‘object_ptr’
if (unsubscribe_callback.object_ptr != NULL) {
^
In file included from /usr/include/php/20151012/Zend/zend.h:31:0,
from /usr/include/php/20151012/main/php.h:36,
from /tmp/pear/temp/Mosquitto/mosquitto.c:5:
/tmp/pear/temp/Mosquitto/mosquitto.c:560:34: error: ‘zend_fcall_info {aka struct _zend_fcall_info}’ has no member named ‘object_ptr’
Z_ADDREF_P(unsubscribe_callback.object_ptr);
^
/usr/include/php/20151012/Zend/zend_types.h:787:41: note: in definition of macro ‘Z_ADDREF_P’
#define Z_ADDREF_P(pz) zval_addref_p(pz)
^
/tmp/pear/temp/Mosquitto/mosquitto.c: In function ‘zim_Mosquitto_Client_onMessage’:
/tmp/pear/temp/Mosquitto/mosquitto.c:591:13: error: incompatible type for argument 1 of ‘zval_addref_p’
Z_ADDREF_P(message_callback.function_name);
^
/usr/include/php/20151012/Zend/zend_types.h:787:41: note: in definition of macro ‘Z_ADDREF_P’
#define Z_ADDREF_P(pz) zval_addref_p(pz)
^
/usr/include/php/20151012/Zend/zend_types.h:820:36: note: expected ‘zval * {aka struct _zval_struct _}’ but argument is of type ‘zval {aka struct zval_struct}’
static zend_always_inline uint32_t zval_addref_p(zval
pz) {
^
/tmp/pear/temp/Mosquitto/mosquitto.c:593:22: error: ‘zend_fcall_info {aka struct _zend_fcall_info}’ has no member named ‘object_ptr’
if (message_callback.object_ptr != NULL) {
^
In file included from /usr/include/php/20151012/Zend/zend.h:31:0,
from /usr/include/php/20151012/main/php.h:36,
from /tmp/pear/temp/Mosquitto/mosquitto.c:5:
/tmp/pear/temp/Mosquitto/mosquitto.c:594:30: error: ‘zend_fcall_info {aka struct _zend_fcall_info}’ has no member named ‘object_ptr’
Z_ADDREF_P(message_callback.object_ptr);
^
/usr/include/php/20151012/Zend/zend_types.h:787:41: note: in definition of macro ‘Z_ADDREF_P’
#define Z_ADDREF_P(pz) zval_addref_p(pz)
^
/tmp/pear/temp/Mosquitto/mosquitto.c: In function ‘zim_Mosquitto_Client_onPublish’:
/tmp/pear/temp/Mosquitto/mosquitto.c:625:13: error: incompatible type for argument 1 of ‘zval_addref_p’
Z_ADDREF_P(publish_callback.function_name);
^
/usr/include/php/20151012/Zend/zend_types.h:787:41: note: in definition of macro ‘Z_ADDREF_P’
#define Z_ADDREF_P(pz) zval_addref_p(pz)
^
/usr/include/php/20151012/Zend/zend_types.h:820:36: note: expected ‘zval * {aka struct _zval_struct _}’ but argument is of type ‘zval {aka struct zval_struct}’
static zend_always_inline uint32_t zval_addref_p(zval
pz) {
^
/tmp/pear/temp/Mosquitto/mosquitto.c:627:22: error: ‘zend_fcall_info {aka struct _zend_fcall_info}’ has no member named ‘object_ptr’
if (publish_callback.object_ptr != NULL) {
^
In file included from /usr/include/php/20151012/Zend/zend.h:31:0,
from /usr/include/php/20151012/main/php.h:36,
from /tmp/pear/temp/Mosquitto/mosquitto.c:5:
/tmp/pear/temp/Mosquitto/mosquitto.c:628:30: error: ‘zend_fcall_info {aka struct _zend_fcall_info}’ has no member named ‘object_ptr’
Z_ADDREF_P(publish_callback.object_ptr);
^
/usr/include/php/20151012/Zend/zend_types.h:787:41: note: in definition of macro ‘Z_ADDREF_P’
#define Z_ADDREF_P(pz) zval_addref_p(pz)
^
/tmp/pear/temp/Mosquitto/mosquitto.c: In function ‘mosquitto_client_object_get’:
/tmp/pear/temp/Mosquitto/mosquitto.c:862:34: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
mosquitto_client_object _pobj = zend_object_store_get_object(zobj TSRMLS_CC);
^
In file included from /tmp/pear/temp/Mosquitto/mosquitto.c:12:0:
/tmp/pear/temp/Mosquitto/mosquitto.c: In function ‘mosquitto_client_object_destroy’:
/tmp/pear/temp/Mosquitto/php_mosquitto.h:98:35: error: ‘zend_fcall_info {aka struct _zend_fcall_info}’ has no member named ‘object_ptr’
if (client->CALLBACK ## _callback.object_ptr != NULL) {
^
/tmp/pear/temp/Mosquitto/mosquitto.c:884:2: note: in expansion of macro ‘PHP_MOSQUITTO_FREE_CALLBACK’
PHP_MOSQUITTO_FREE_CALLBACK(connect);
^
In file included from /usr/include/php/20151012/Zend/zend.h:39:0,
from /usr/include/php/20151012/main/php.h:36,
from /tmp/pear/temp/Mosquitto/mosquitto.c:5:
/tmp/pear/temp/Mosquitto/php_mosquitto.h:99:47: error: ‘zend_fcall_info {aka struct _zend_fcall_info}’ has no member named ‘object_ptr’
zval_ptr_dtor(&client->CALLBACK ## _callback.object_ptr);
^
/usr/include/php/20151012/Zend/zend_variables.h:122:49: note: in definition of macro ‘zval_ptr_dtor’
#define zval_ptr_dtor(zval_ptr) _zval_ptr_dtor((zval_ptr) ZEND_FILE_LINE_CC)
^
/tmp/pear/temp/Mosquitto/mosquitto.c:884:2: note: in expansion of macro ‘PHP_MOSQUITTO_FREE_CALLBACK’
PHP_MOSQUITTO_FREE_CALLBACK(connect);
^
In file included from /tmp/pear/temp/Mosquitto/mosquitto.c:12:0:
/tmp/pear/temp/Mosquitto/php_mosquitto.h:98:35: error: ‘zend_fcall_info {aka struct _zend_fcall_info}’ has no member named ‘object_ptr’
if (client->CALLBACK ## _callback.object_ptr != NULL) {
^
/tmp/pear/temp/Mosquitto/mosquitto.c:885:2: note: in expansion of macro ‘PHP_MOSQUITTO_FREE_CALLBACK’
PHP_MOSQUITTO_FREE_CALLBACK(subscribe);
^
In file included from /usr/include/php/20151012/Zend/zend.h:39:0,
from /usr/include/php/20151012/main/php.h:36,
from /tmp/pear/temp/Mosquitto/mosquitto.c:5:
/tmp/pear/temp/Mosquitto/php_mosquitto.h:99:47: error: ‘zend_fcall_info {aka struct _zend_fcall_info}’ has no member named ‘object_ptr’
zval_ptr_dtor(&client->CALLBACK ## _callback.object_ptr);
^
/usr/include/php/20151012/Zend/zend_variables.h:122:49: note: in definition of macro ‘zval_ptr_dtor’
#define zval_ptr_dtor(zval_ptr) _zval_ptr_dtor((zval_ptr) ZEND_FILE_LINE_CC)
^
/tmp/pear/temp/Mosquitto/mosquitto.c:885:2: note: in expansion of macro ‘PHP_MOSQUITTO_FREE_CALLBACK’
PHP_MOSQUITTO_FREE_CALLBACK(subscribe);
^
In file included from /tmp/pear/temp/Mosquitto/mosquitto.c:12:0:
/tmp/pear/temp/Mosquitto/php_mosquitto.h:98:35: error: ‘zend_fcall_info {aka struct _zend_fcall_info}’ has no member named ‘object_ptr’
if (client->CALLBACK ## _callback.object_ptr != NULL) {
^
/tmp/pear/temp/Mosquitto/mosquitto.c:886:2: note: in expansion of macro ‘PHP_MOSQUITTO_FREE_CALLBACK’
PHP_MOSQUITTO_FREE_CALLBACK(unsubscribe);
^
In file included from /usr/include/php/20151012/Zend/zend.h:39:0,
from /usr/include/php/20151012/main/php.h:36,
from /tmp/pear/temp/Mosquitto/mosquitto.c:5:
/tmp/pear/temp/Mosquitto/php_mosquitto.h:99:47: error: ‘zend_fcall_info {aka struct _zend_fcall_info}’ has no member named ‘object_ptr’
zval_ptr_dtor(&client->CALLBACK ## _callback.object_ptr);
^
/usr/include/php/20151012/Zend/zend_variables.h:122:49: note: in definition of macro ‘zval_ptr_dtor’
#define zval_ptr_dtor(zval_ptr) _zval_ptr_dtor((zval_ptr) ZEND_FILE_LINE_CC)
^
/tmp/pear/temp/Mosquitto/mosquitto.c:886:2: note: in expansion of macro ‘PHP_MOSQUITTO_FREE_CALLBACK’
PHP_MOSQUITTO_FREE_CALLBACK(unsubscribe);
^
In file included from /tmp/pear/temp/Mosquitto/mosquitto.c:12:0:
/tmp/pear/temp/Mosquitto/php_mosquitto.h:98:35: error: ‘zend_fcall_info {aka struct _zend_fcall_info}’ has no member named ‘object_ptr’
if (client->CALLBACK ## _callback.object_ptr != NULL) {
^
/tmp/pear/temp/Mosquitto/mosquitto.c:887:2: note: in expansion of macro ‘PHP_MOSQUITTO_FREE_CALLBACK’
PHP_MOSQUITTO_FREE_CALLBACK(publish);
^
In file included from /usr/include/php/20151012/Zend/zend.h:39:0,
from /usr/include/php/20151012/main/php.h:36,
from /tmp/pear/temp/Mosquitto/mosquitto.c:5:
/tmp/pear/temp/Mosquitto/php_mosquitto.h:99:47: error: ‘zend_fcall_info {aka struct _zend_fcall_info}’ has no member named ‘object_ptr’
zval_ptr_dtor(&client->CALLBACK ## _callback.object_ptr);
^
/usr/include/php/20151012/Zend/zend_variables.h:122:49: note: in definition of macro ‘zval_ptr_dtor’
#define zval_ptr_dtor(zval_ptr) _zval_ptr_dtor((zval_ptr) ZEND_FILE_LINE_CC)
^
/tmp/pear/temp/Mosquitto/mosquitto.c:887:2: note: in expansion of macro ‘PHP_MOSQUITTO_FREE_CALLBACK’
PHP_MOSQUITTO_FREE_CALLBACK(publish);
^
In file included from /tmp/pear/temp/Mosquitto/mosquitto.c:12:0:
/tmp/pear/temp/Mosquitto/php_mosquitto.h:98:35: error: ‘zend_fcall_info {aka struct _zend_fcall_info}’ has no member named ‘object_ptr’
if (client->CALLBACK ## _callback.object_ptr != NULL) {
^
/tmp/pear/temp/Mosquitto/mosquitto.c:888:2: note: in expansion of macro ‘PHP_MOSQUITTO_FREE_CALLBACK’
PHP_MOSQUITTO_FREE_CALLBACK(message);
^
In file included from /usr/include/php/20151012/Zend/zend.h:39:0,
from /usr/include/php/20151012/main/php.h:36,
from /tmp/pear/temp/Mosquitto/mosquitto.c:5:
/tmp/pear/temp/Mosquitto/php_mosquitto.h:99:47: error: ‘zend_fcall_info {aka struct _zend_fcall_info}’ has no member named ‘object_ptr’
zval_ptr_dtor(&client->CALLBACK ## _callback.object_ptr);
^
/usr/include/php/20151012/Zend/zend_variables.h:122:49: note: in definition of macro ‘zval_ptr_dtor’
#define zval_ptr_dtor(zval_ptr) _zval_ptr_dtor((zval_ptr) ZEND_FILE_LINE_CC)
^
/tmp/pear/temp/Mosquitto/mosquitto.c:888:2: note: in expansion of macro ‘PHP_MOSQUITTO_FREE_CALLBACK’
PHP_MOSQUITTO_FREE_CALLBACK(message);
^
In file included from /tmp/pear/temp/Mosquitto/mosquitto.c:12:0:
/tmp/pear/temp/Mosquitto/php_mosquitto.h:98:35: error: ‘zend_fcall_info {aka struct _zend_fcall_info}’ has no member named ‘object_ptr’
if (client->CALLBACK ## _callback.object_ptr != NULL) {
^
/tmp/pear/temp/Mosquitto/mosquitto.c:889:2: note: in expansion of macro ‘PHP_MOSQUITTO_FREE_CALLBACK’
PHP_MOSQUITTO_FREE_CALLBACK(disconnect);
^
In file included from /usr/include/php/20151012/Zend/zend.h:39:0,
from /usr/include/php/20151012/main/php.h:36,
from /tmp/pear/temp/Mosquitto/mosquitto.c:5:
/tmp/pear/temp/Mosquitto/php_mosquitto.h:99:47: error: ‘zend_fcall_info {aka struct _zend_fcall_info}’ has no member named ‘object_ptr’
zval_ptr_dtor(&client->CALLBACK ## _callback.object_ptr);
^
/usr/include/php/20151012/Zend/zend_variables.h:122:49: note: in definition of macro ‘zval_ptr_dtor’
#define zval_ptr_dtor(zval_ptr) _zval_ptr_dtor((zval_ptr) ZEND_FILE_LINE_CC)
^
/tmp/pear/temp/Mosquitto/mosquitto.c:889:2: note: in expansion of macro ‘PHP_MOSQUITTO_FREE_CALLBACK’
PHP_MOSQUITTO_FREE_CALLBACK(disconnect);
^
In file included from /tmp/pear/temp/Mosquitto/mosquitto.c:12:0:
/tmp/pear/temp/Mosquitto/php_mosquitto.h:98:35: error: ‘zend_fcall_info {aka struct _zend_fcall_info}’ has no member named ‘object_ptr’
if (client->CALLBACK ## _callback.object_ptr != NULL) {
^
/tmp/pear/temp/Mosquitto/mosquitto.c:890:2: note: in expansion of macro ‘PHP_MOSQUITTO_FREE_CALLBACK’
PHP_MOSQUITTO_FREE_CALLBACK(log);
^
In file included from /usr/include/php/20151012/Zend/zend.h:39:0,
from /usr/include/php/20151012/main/php.h:36,
from /tmp/pear/temp/Mosquitto/mosquitto.c:5:
/tmp/pear/temp/Mosquitto/php_mosquitto.h:99:47: error: ‘zend_fcall_info {aka struct _zend_fcall_info}’ has no member named ‘object_ptr’
zval_ptr_dtor(&client->CALLBACK ## _callback.object_ptr);
^
/usr/include/php/20151012/Zend/zend_variables.h:122:49: note: in definition of macro ‘zval_ptr_dtor’
#define zval_ptr_dtor(zval_ptr) _zval_ptr_dtor((zval_ptr) ZEND_FILE_LINE_CC)
^
/tmp/pear/temp/Mosquitto/mosquitto.c:890:2: note: in expansion of macro ‘PHP_MOSQUITTO_FREE_CALLBACK’
PHP_MOSQUITTO_FREE_CALLBACK(log);
^
/tmp/pear/temp/Mosquitto/mosquitto.c: At top level:
/tmp/pear/temp/Mosquitto/mosquitto.c:900:8: error: unknown type name ‘zend_object_value’
static zend_object_value mosquitto_client_object_new(zend_class_entry *ce TSRMLS_DC) {
^
/tmp/pear/temp/Mosquitto/mosquitto.c: In function ‘mosquitto_client_object_new’:
/tmp/pear/temp/Mosquitto/mosquitto.c:902:2: error: unknown type name ‘zend_object_value’
zend_object_value retval;
^
/tmp/pear/temp/Mosquitto/mosquitto.c:923:8: error: request for member ‘handle’ in something not a structure or union
retval.handle = zend_objects_store_put(client, NULL, (zend_objects_free_object_storage_t) mosquitto_client_object_destroy, NULL TSRMLS_CC);
^
/tmp/pear/temp/Mosquitto/mosquitto.c:923:56: error: ‘zend_objects_free_object_storage_t’ undeclared (first use in this function)
retval.handle = zend_objects_store_put(client, NULL, (zend_objects_free_object_storage_t) mosquitto_client_object_destroy, NULL TSRMLS_CC);
^
/tmp/pear/temp/Mosquitto/mosquitto.c:923:56: note: each undeclared identifier is reported only once for each function it appears in
/tmp/pear/temp/Mosquitto/mosquitto.c:923:92: error: expected ‘)’ before ‘mosquitto_client_object_destroy’
retval.handle = zend_objects_store_put(client, NULL, (zend_objects_free_object_storage_t) mosquitto_client_object_destroy, NULL TSRMLS_CC);
^
/tmp/pear/temp/Mosquitto/mosquitto.c:923:41: warning: passing argument 1 of ‘zend_objects_store_put’ from incompatible pointer type [-Wincompatible-pointer-types]
retval.handle = zend_objects_store_put(client, NULL, (zend_objects_free_object_storage_t) mosquitto_client_object_destroy, NULL TSRMLS_CC);
^
In file included from /usr/include/php/20151012/Zend/zend_globals.h:35:0,
from /usr/include/php/20151012/Zend/zend_compile.h:657,
from /usr/include/php/20151012/Zend/zend_modules.h:26,
from /usr/include/php/20151012/Zend/zend_API.h:27,
from /usr/include/php/20151012/main/php.h:40,
from /tmp/pear/temp/Mosquitto/mosquitto.c:5:
/usr/include/php/20151012/Zend/zend_objects_API.h:58:15: note: expected ‘zend_object * {aka struct _zend_object *}’ but argument is of type ‘mosquitto_client_object * {aka struct mosquitto_client_object *}’
ZEND_API void zend_objects_store_put(zend_object *object);
^
/tmp/pear/temp/Mosquitto/mosquitto.c:923:18: error: too many arguments to function ‘zend_objects_store_put’
retval.handle = zend_objects_store_put(client, NULL, (zend_objects_free_object_storage_t) mosquitto_client_object_destroy, NULL TSRMLS_CC);
^
In file included from /usr/include/php/20151012/Zend/zend_globals.h:35:0,
from /usr/include/php/20151012/Zend/zend_compile.h:657,
from /usr/include/php/20151012/Zend/zend_modules.h:26,
from /usr/include/php/20151012/Zend/zend_API.h:27,
from /usr/include/php/20151012/main/php.h:40,
from /tmp/pear/temp/Mosquitto/mosquitto.c:5:
/usr/include/php/20151012/Zend/zend_objects_API.h:58:15: note: declared here
ZEND_API void zend_objects_store_put(zend_object *object);
^
/tmp/pear/temp/Mosquitto/mosquitto.c:924:8: error: request for member ‘handlers’ in something not a structure or union
retval.handlers = &mosquitto_std_object_handlers;
^
/tmp/pear/temp/Mosquitto/mosquitto.c: In function ‘php_mosquitto_connect_callback’:
/tmp/pear/temp/Mosquitto/mosquitto.c:961:2: warning: implicit declaration of function ‘MAKE_STD_ZVAL’ [-Wimplicit-function-declaration]
MAKE_STD_ZVAL(rc_zval);
^
/tmp/pear/temp/Mosquitto/mosquitto.c:967:56: error: macro "ZVAL_STRINGL" passed 4 arguments, but takes just 3
ZVAL_STRINGL(message_zval, message, strlen(message), 1);
^
/tmp/pear/temp/Mosquitto/mosquitto.c:967:2: error: ‘ZVAL_STRINGL’ undeclared (first use in this function)
ZVAL_STRINGL(message_zval, message, strlen(message), 1);
^
/tmp/pear/temp/Mosquitto/mosquitto.c:970:34: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
object->connect_callback.params = params;
^
/tmp/pear/temp/Mosquitto/mosquitto.c:972:26: error: ‘zend_fcall_info {aka struct zend_fcall_info}’ has no member named ‘retval_ptr_ptr’
object->connect_callback.retval_ptr_ptr = &retval_ptr;
^
In file included from /usr/include/php/20151012/Zend/zend.h:35:0,
from /usr/include/php/20151012/main/php.h:36,
from /tmp/pear/temp/Mosquitto/mosquitto.c:5:
/usr/include/php/20151012/Zend/zend_types.h:516:39: error: invalid type argument of unary ‘
’ (have ‘zval {aka struct zval_struct}’)
#define Z_STRVAL_P(zval_p) Z_STRVAL(
(zval_p))
^
/usr/include/php/20151012/Zend/zend_string.h:40:26: note: in definition of macro ‘ZSTR_VAL’
#define ZSTR_VAL(zstr) (zstr)->val
^
/usr/include/php/20151012/Zend/zend_types.h:515:36: note: in expansion of macro ‘Z_STR’
#define Z_STRVAL(zval) ZSTR_VAL(Z_STR(zval))
^
/usr/include/php/20151012/Zend/zend_types.h:516:30: note: in expansion of macro ‘Z_STRVAL’
#define Z_STRVAL_P(zval_p) Z_STRVAL(
(zval_p))
^
/tmp/pear/temp/Mosquitto/mosquitto.c:976:107: note: in expansion of macro ‘Z_STRVAL_P’
zend_throw_exception_ex(mosquitto_ce_exception, 0 TSRMLS_CC, "Failed to invoke connect callback %s()", Z_STRVAL_P(object->connect_callback.function_name));
^
In file included from /usr/include/php/20151012/Zend/zend.h:39:0,
from /usr/include/php/20151012/main/php.h:36,
from /tmp/pear/temp/Mosquitto/mosquitto.c:5:
/usr/include/php/20151012/Zend/zend_variables.h:122:48: warning: passing argument 1 of ‘_zval_ptr_dtor’ from incompatible pointer type [-Wincompatible-pointer-types]
#define zval_ptr_dtor(zval_ptr) _zval_ptr_dtor((zval_ptr) ZEND_FILE_LINE_CC)
^
/tmp/pear/temp/Mosquitto/mosquitto.c:980:2: note: in expansion of macro ‘zval_ptr_dtor’
zval_ptr_dtor(&rc_zval);
^
/usr/include/php/20151012/Zend/zend_variables.h:112:15: note: expected ‘zval * {aka struct _zval_struct }’ but argument is of type ‘zval * {aka struct zval_struct *}’
ZEND_API void _zval_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC);
^
/usr/include/php/20151012/Zend/zend_variables.h:122:48: warning: passing argument 1 of ‘_zval_ptr_dtor’ from incompatible pointer type [-Wincompatible-pointer-types]
#define zval_ptr_dtor(zval_ptr) _zval_ptr_dtor((zval_ptr) ZEND_FILE_LINE_CC)
^
/tmp/pear/temp/Mosquitto/mosquitto.c:981:2: note: in expansion of macro ‘zval_ptr_dtor’
zval_ptr_dtor(&message_zval);
^
/usr/include/php/20151012/Zend/zend_variables.h:112:15: note: expected ‘zval * {aka struct zval_struct *}’ but argument is of type ‘zval * {aka struct zval_struct *}’
ZEND_API void _zval_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC);
^
/usr/include/php/20151012/Zend/zend_variables.h:122:48: warning: passing argument 1 of ‘_zval_ptr_dtor’ from incompatible pointer type [-Wincompatible-pointer-types]
#define zval_ptr_dtor(zval_ptr) _zval_ptr_dtor((zval_ptr) ZEND_FILE_LINE_CC)
^
/tmp/pear/temp/Mosquitto/mosquitto.c:984:3: note: in expansion of macro ‘zval_ptr_dtor’
zval_ptr_dtor(&retval_ptr);
^
/usr/include/php/20151012/Zend/zend_variables.h:112:15: note: expected ‘zval * {aka struct zval_struct *}’ but argument is of type ‘zval * {aka struct zval_struct *}’
ZEND_API void zval_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC);
^
/tmp/pear/temp/Mosquitto/mosquitto.c: In function ‘php_mosquitto_disconnect_callback’:
/tmp/pear/temp/Mosquitto/mosquitto.c:1005:37: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
object->disconnect_callback.params = params;
^
/tmp/pear/temp/Mosquitto/mosquitto.c:1007:29: error: ‘zend_fcall_info {aka struct zend_fcall_info}’ has no member named ‘retval_ptr_ptr’
object->disconnect_callback.retval_ptr_ptr = &retval_ptr;
^
In file included from /usr/include/php/20151012/Zend/zend.h:35:0,
from /usr/include/php/20151012/main/php.h:36,
from /tmp/pear/temp/Mosquitto/mosquitto.c:5:
/usr/include/php/20151012/Zend/zend_types.h:516:39: error: invalid type argument of unary ‘
’ (have ‘zval {aka struct zval_struct}’)
#define Z_STRVAL_P(zval_p) Z_STRVAL(
(zval_p))
^
/usr/include/php/20151012/Zend/zend_string.h:40:26: note: in definition of macro ‘ZSTR_VAL’
#define ZSTR_VAL(zstr) (zstr)->val
^
/usr/include/php/20151012/Zend/zend_types.h:515:36: note: in expansion of macro ‘Z_STR’
#define Z_STRVAL(zval) ZSTR_VAL(Z_STR(zval))
^
/usr/include/php/20151012/Zend/zend_types.h:516:30: note: in expansion of macro ‘Z_STRVAL’
#define Z_STRVAL_P(zval_p) Z_STRVAL(
(zval_p))
^
/tmp/pear/temp/Mosquitto/mosquitto.c:1011:110: note: in expansion of macro ‘Z_STRVAL_P’
zend_throw_exception_ex(mosquitto_ce_exception, 0 TSRMLS_CC, "Failed to invoke disconnect callback %s()", Z_STRVAL_P(object->disconnect_callback.function_name));
^
In file included from /usr/include/php/20151012/Zend/zend.h:39:0,
from /usr/include/php/20151012/main/php.h:36,
from /tmp/pear/temp/Mosquitto/mosquitto.c:5:
/usr/include/php/20151012/Zend/zend_variables.h:122:48: warning: passing argument 1 of ‘_zval_ptr_dtor’ from incompatible pointer type [-Wincompatible-pointer-types]
#define zval_ptr_dtor(zval_ptr) _zval_ptr_dtor((zval_ptr) ZEND_FILE_LINE_CC)
^
/tmp/pear/temp/Mosquitto/mosquitto.c:1015:2: note: in expansion of macro ‘zval_ptr_dtor’
zval_ptr_dtor(&rc_zval);
^
/usr/include/php/20151012/Zend/zend_variables.h:112:15: note: expected ‘zval * {aka struct _zval_struct }’ but argument is of type ‘zval * {aka struct zval_struct *}’
ZEND_API void _zval_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC);
^
/usr/include/php/20151012/Zend/zend_variables.h:122:48: warning: passing argument 1 of ‘_zval_ptr_dtor’ from incompatible pointer type [-Wincompatible-pointer-types]
#define zval_ptr_dtor(zval_ptr) _zval_ptr_dtor((zval_ptr) ZEND_FILE_LINE_CC)
^
/tmp/pear/temp/Mosquitto/mosquitto.c:1018:3: note: in expansion of macro ‘zval_ptr_dtor’
zval_ptr_dtor(&retval_ptr);
^
/usr/include/php/20151012/Zend/zend_variables.h:112:15: note: expected ‘zval * {aka struct zval_struct *}’ but argument is of type ‘zval * {aka struct zval_struct *}’
ZEND_API void zval_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC);
^
/tmp/pear/temp/Mosquitto/mosquitto.c: In function ‘php_mosquitto_log_callback’:
/tmp/pear/temp/Mosquitto/mosquitto.c:1039:44: error: macro "ZVAL_STRINGL" passed 4 arguments, but takes just 3
ZVAL_STRINGL(str_zval, str, strlen(str), 1);
^
/tmp/pear/temp/Mosquitto/mosquitto.c:1039:2: error: ‘ZVAL_STRINGL’ undeclared (first use in this function)
ZVAL_STRINGL(str_zval, str, strlen(str), 1);
^
/tmp/pear/temp/Mosquitto/mosquitto.c:1044:30: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
object->log_callback.params = params;
^
/tmp/pear/temp/Mosquitto/mosquitto.c:1046:22: error: ‘zend_fcall_info {aka struct zend_fcall_info}’ has no member named ‘retval_ptr_ptr’
object->log_callback.retval_ptr_ptr = &retval_ptr;
^
In file included from /usr/include/php/20151012/Zend/zend.h:35:0,
from /usr/include/php/20151012/main/php.h:36,
from /tmp/pear/temp/Mosquitto/mosquitto.c:5:
/usr/include/php/20151012/Zend/zend_types.h:516:39: error: invalid type argument of unary ‘
’ (have ‘zval {aka struct zval_struct}’)
#define Z_STRVAL_P(zval_p) Z_STRVAL(
(zval_p))
^
/usr/include/php/20151012/Zend/zend_string.h:40:26: note: in definition of macro ‘ZSTR_VAL’
#define ZSTR_VAL(zstr) (zstr)->val
^
/usr/include/php/20151012/Zend/zend_types.h:515:36: note: in expansion of macro ‘Z_STR’
#define Z_STRVAL(zval) ZSTR_VAL(Z_STR(zval))
^
/usr/include/php/20151012/Zend/zend_types.h:516:30: note: in expansion of macro ‘Z_STRVAL’
#define Z_STRVAL_P(zval_p) Z_STRVAL(
(zval_p))
^
/tmp/pear/temp/Mosquitto/mosquitto.c:1050:103: note: in expansion of macro ‘Z_STRVAL_P’
zend_throw_exception_ex(mosquitto_ce_exception, 0 TSRMLS_CC, "Failed to invoke log callback %s()", Z_STRVAL_P(object->log_callback.function_name));
^
In file included from /usr/include/php/20151012/Zend/zend.h:39:0,
from /usr/include/php/20151012/main/php.h:36,
from /tmp/pear/temp/Mosquitto/mosquitto.c:5:
/usr/include/php/20151012/Zend/zend_variables.h:122:48: warning: passing argument 1 of ‘_zval_ptr_dtor’ from incompatible pointer type [-Wincompatible-pointer-types]
#define zval_ptr_dtor(zval_ptr) _zval_ptr_dtor((zval_ptr) ZEND_FILE_LINE_CC)
^
/tmp/pear/temp/Mosquitto/mosquitto.c:1054:2: note: in expansion of macro ‘zval_ptr_dtor’
zval_ptr_dtor(params[0]);
^
/usr/include/php/20151012/Zend/zend_variables.h:112:15: note: expected ‘zval * {aka struct _zval_struct }’ but argument is of type ‘zval * {aka struct zval_struct *}’
ZEND_API void _zval_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC);
^
/usr/include/php/20151012/Zend/zend_variables.h:122:48: warning: passing argument 1 of ‘_zval_ptr_dtor’ from incompatible pointer type [-Wincompatible-pointer-types]
#define zval_ptr_dtor(zval_ptr) _zval_ptr_dtor((zval_ptr) ZEND_FILE_LINE_CC)
^
/tmp/pear/temp/Mosquitto/mosquitto.c:1055:2: note: in expansion of macro ‘zval_ptr_dtor’
zval_ptr_dtor(params[1]);
^
/usr/include/php/20151012/Zend/zend_variables.h:112:15: note: expected ‘zval * {aka struct zval_struct *}’ but argument is of type ‘zval * {aka struct zval_struct *}’
ZEND_API void _zval_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC);
^
/usr/include/php/20151012/Zend/zend_variables.h:122:48: warning: passing argument 1 of ‘_zval_ptr_dtor’ from incompatible pointer type [-Wincompatible-pointer-types]
#define zval_ptr_dtor(zval_ptr) _zval_ptr_dtor((zval_ptr) ZEND_FILE_LINE_CC)
^
/tmp/pear/temp/Mosquitto/mosquitto.c:1058:3: note: in expansion of macro ‘zval_ptr_dtor’
zval_ptr_dtor(&retval_ptr);
^
/usr/include/php/20151012/Zend/zend_variables.h:112:15: note: expected ‘zval * {aka struct zval_struct *}’ but argument is of type ‘zval * {aka struct zval_struct *}’
ZEND_API void zval_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC);
^
/tmp/pear/temp/Mosquitto/mosquitto.c: In function ‘php_mosquitto_message_callback’:
/tmp/pear/temp/Mosquitto/mosquitto.c:1078:19: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
message_object = (mosquitto_message_object *) zend_object_store_get_object(message_zval TSRMLS_CC);
^
/tmp/pear/temp/Mosquitto/mosquitto.c:1082:34: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
object->message_callback.params = params;
^
/tmp/pear/temp/Mosquitto/mosquitto.c:1084:26: error: ‘zend_fcall_info {aka struct zend_fcall_info}’ has no member named ‘retval_ptr_ptr’
object->message_callback.retval_ptr_ptr = &retval_ptr;
^
In file included from /usr/include/php/20151012/Zend/zend.h:35:0,
from /usr/include/php/20151012/main/php.h:36,
from /tmp/pear/temp/Mosquitto/mosquitto.c:5:
/usr/include/php/20151012/Zend/zend_types.h:516:39: error: invalid type argument of unary ‘
’ (have ‘zval {aka struct zval_struct}’)
#define Z_STRVAL_P(zval_p) Z_STRVAL(
(zval_p))
^
/usr/include/php/20151012/Zend/zend_string.h:40:26: note: in definition of macro ‘ZSTR_VAL’
#define ZSTR_VAL(zstr) (zstr)->val
^
/usr/include/php/20151012/Zend/zend_types.h:515:36: note: in expansion of macro ‘Z_STR’
#define Z_STRVAL(zval) ZSTR_VAL(Z_STR(zval))
^
/usr/include/php/20151012/Zend/zend_types.h:516:30: note: in expansion of macro ‘Z_STRVAL’
#define Z_STRVAL_P(zval_p) Z_STRVAL(
(zval_p))
^
/tmp/pear/temp/Mosquitto/mosquitto.c:1088:107: note: in expansion of macro ‘Z_STRVAL_P’
zend_throw_exception_ex(mosquitto_ce_exception, 0 TSRMLS_CC, "Failed to invoke message callback %s()", Z_STRVAL_P(object->message_callback.function_name));
^
In file included from /usr/include/php/20151012/Zend/zend.h:39:0,
from /usr/include/php/20151012/main/php.h:36,
from /tmp/pear/temp/Mosquitto/mosquitto.c:5:
/usr/include/php/20151012/Zend/zend_variables.h:122:48: warning: passing argument 1 of ‘_zval_ptr_dtor’ from incompatible pointer type [-Wincompatible-pointer-types]
#define zval_ptr_dtor(zval_ptr) _zval_ptr_dtor((zval_ptr) ZEND_FILE_LINE_CC)
^
/tmp/pear/temp/Mosquitto/mosquitto.c:1092:2: note: in expansion of macro ‘zval_ptr_dtor’
zval_ptr_dtor(&message_zval);
^
/usr/include/php/20151012/Zend/zend_variables.h:112:15: note: expected ‘zval * {aka struct _zval_struct }’ but argument is of type ‘zval * {aka struct zval_struct *}’
ZEND_API void _zval_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC);
^
/usr/include/php/20151012/Zend/zend_variables.h:122:48: warning: passing argument 1 of ‘_zval_ptr_dtor’ from incompatible pointer type [-Wincompatible-pointer-types]
#define zval_ptr_dtor(zval_ptr) _zval_ptr_dtor((zval_ptr) ZEND_FILE_LINE_CC)
^
/tmp/pear/temp/Mosquitto/mosquitto.c:1095:3: note: in expansion of macro ‘zval_ptr_dtor’
zval_ptr_dtor(&retval_ptr);
^
/usr/include/php/20151012/Zend/zend_variables.h:112:15: note: expected ‘zval * {aka struct zval_struct *}’ but argument is of type ‘zval * {aka struct zval_struct *}’
ZEND_API void zval_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC);
^
/tmp/pear/temp/Mosquitto/mosquitto.c: In function ‘php_mosquitto_publish_callback’:
/tmp/pear/temp/Mosquitto/mosquitto.c:1118:34: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
object->publish_callback.params = params;
^
/tmp/pear/temp/Mosquitto/mosquitto.c:1120:26: error: ‘zend_fcall_info {aka struct zend_fcall_info}’ has no member named ‘retval_ptr_ptr’
object->publish_callback.retval_ptr_ptr = &retval_ptr;
^
In file included from /usr/include/php/20151012/Zend/zend.h:35:0,
from /usr/include/php/20151012/main/php.h:36,
from /tmp/pear/temp/Mosquitto/mosquitto.c:5:
/usr/include/php/20151012/Zend/zend_types.h:516:39: error: invalid type argument of unary ‘
’ (have ‘zval {aka struct zval_struct}’)
#define Z_STRVAL_P(zval_p) Z_STRVAL(
(zval_p))
^
/usr/include/php/20151012/Zend/zend_string.h:40:26: note: in definition of macro ‘ZSTR_VAL’
#define ZSTR_VAL(zstr) (zstr)->val
^
/usr/include/php/20151012/Zend/zend_types.h:515:36: note: in expansion of macro ‘Z_STR’
#define Z_STRVAL(zval) ZSTR_VAL(Z_STR(zval))
^
/usr/include/php/20151012/Zend/zend_types.h:516:30: note: in expansion of macro ‘Z_STRVAL’
#define Z_STRVAL_P(zval_p) Z_STRVAL(
(zval_p))
^
/tmp/pear/temp/Mosquitto/mosquitto.c:1124:107: note: in expansion of macro ‘Z_STRVAL_P’
zend_throw_exception_ex(mosquitto_ce_exception, 0 TSRMLS_CC, "Failed to invoke publish callback %s()", Z_STRVAL_P(object->publish_callback.function_name));
^
In file included from /usr/include/php/20151012/Zend/zend.h:39:0,
from /usr/include/php/20151012/main/php.h:36,
from /tmp/pear/temp/Mosquitto/mosquitto.c:5:
/usr/include/php/20151012/Zend/zend_variables.h:122:48: warning: passing argument 1 of ‘_zval_ptr_dtor’ from incompatible pointer type [-Wincompatible-pointer-types]
#define zval_ptr_dtor(zval_ptr) _zval_ptr_dtor((zval_ptr) ZEND_FILE_LINE_CC)
^
/tmp/pear/temp/Mosquitto/mosquitto.c:1128:2: note: in expansion of macro ‘zval_ptr_dtor’
zval_ptr_dtor(params[0]);
^
/usr/include/php/20151012/Zend/zend_variables.h:112:15: note: expected ‘zval * {aka struct _zval_struct }’ but argument is of type ‘zval * {aka struct zval_struct *}’
ZEND_API void _zval_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC);
^
/usr/include/php/20151012/Zend/zend_variables.h:122:48: warning: passing argument 1 of ‘_zval_ptr_dtor’ from incompatible pointer type [-Wincompatible-pointer-types]
#define zval_ptr_dtor(zval_ptr) _zval_ptr_dtor((zval_ptr) ZEND_FILE_LINE_CC)
^
/tmp/pear/temp/Mosquitto/mosquitto.c:1131:3: note: in expansion of macro ‘zval_ptr_dtor’
zval_ptr_dtor(&retval_ptr);
^
/usr/include/php/20151012/Zend/zend_variables.h:112:15: note: expected ‘zval * {aka struct zval_struct *}’ but argument is of type ‘zval * {aka struct zval_struct *}’
ZEND_API void zval_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC);
^
/tmp/pear/temp/Mosquitto/mosquitto.c: In function ‘php_mosquitto_subscribe_callback’:
/tmp/pear/temp/Mosquitto/mosquitto.c:1161:36: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
object->subscribe_callback.params = params;
^
/tmp/pear/temp/Mosquitto/mosquitto.c:1163:28: error: ‘zend_fcall_info {aka struct zend_fcall_info}’ has no member named ‘retval_ptr_ptr’
object->subscribe_callback.retval_ptr_ptr = &retval_ptr;
^
In file included from /usr/include/php/20151012/Zend/zend.h:35:0,
from /usr/include/php/20151012/main/php.h:36,
from /tmp/pear/temp/Mosquitto/mosquitto.c:5:
/usr/include/php/20151012/Zend/zend_types.h:516:39: error: invalid type argument of unary ‘
’ (have ‘zval {aka struct zval_struct}’)
#define Z_STRVAL_P(zval_p) Z_STRVAL(
(zval_p))
^
/usr/include/php/20151012/Zend/zend_string.h:40:26: note: in definition of macro ‘ZSTR_VAL’
#define ZSTR_VAL(zstr) (zstr)->val
^
/usr/include/php/20151012/Zend/zend_types.h:515:36: note: in expansion of macro ‘Z_STR’
#define Z_STRVAL(zval) ZSTR_VAL(Z_STR(zval))
^
/usr/include/php/20151012/Zend/zend_types.h:516:30: note: in expansion of macro ‘Z_STRVAL’
#define Z_STRVAL_P(zval_p) Z_STRVAL(
(zval_p))
^
/tmp/pear/temp/Mosquitto/mosquitto.c:1167:109: note: in expansion of macro ‘Z_STRVAL_P’
zend_throw_exception_ex(mosquitto_ce_exception, 0 TSRMLS_CC, "Failed to invoke subscribe callback %s()", Z_STRVAL_P(object->subscribe_callback.function_name));
^
In file included from /usr/include/php/20151012/Zend/zend.h:39:0,
from /usr/include/php/20151012/main/php.h:36,
from /tmp/pear/temp/Mosquitto/mosquitto.c:5:
/usr/include/php/20151012/Zend/zend_variables.h:122:48: warning: passing argument 1 of ‘_zval_ptr_dtor’ from incompatible pointer type [-Wincompatible-pointer-types]
#define zval_ptr_dtor(zval_ptr) _zval_ptr_dtor((zval_ptr) ZEND_FILE_LINE_CC)
^
/tmp/pear/temp/Mosquitto/mosquitto.c:1171:2: note: in expansion of macro ‘zval_ptr_dtor’
zval_ptr_dtor(params[0]);
^
/usr/include/php/20151012/Zend/zend_variables.h:112:15: note: expected ‘zval * {aka struct _zval_struct }’ but argument is of type ‘zval * {aka struct zval_struct *}’
ZEND_API void _zval_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC);
^
/usr/include/php/20151012/Zend/zend_variables.h:122:48: warning: passing argument 1 of ‘_zval_ptr_dtor’ from incompatible pointer type [-Wincompatible-pointer-types]
#define zval_ptr_dtor(zval_ptr) _zval_ptr_dtor((zval_ptr) ZEND_FILE_LINE_CC)
^
/tmp/pear/temp/Mosquitto/mosquitto.c:1172:2: note: in expansion of macro ‘zval_ptr_dtor’
zval_ptr_dtor(params[1]);
^
/usr/include/php/20151012/Zend/zend_variables.h:112:15: note: expected ‘zval * {aka struct zval_struct *}’ but argument is of type ‘zval * {aka struct zval_struct *}’
ZEND_API void _zval_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC);
^
/usr/include/php/20151012/Zend/zend_variables.h:122:48: warning: passing argument 1 of ‘_zval_ptr_dtor’ from incompatible pointer type [-Wincompatible-pointer-types]
#define zval_ptr_dtor(zval_ptr) _zval_ptr_dtor((zval_ptr) ZEND_FILE_LINE_CC)
^
/tmp/pear/temp/Mosquitto/mosquitto.c:1173:2: note: in expansion of macro ‘zval_ptr_dtor’
zval_ptr_dtor(params[2]);
^
/usr/include/php/20151012/Zend/zend_variables.h:112:15: note: expected ‘zval * {aka struct zval_struct *}’ but argument is of type ‘zval * {aka struct zval_struct *}’
ZEND_API void _zval_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC);
^
/usr/include/php/20151012/Zend/zend_variables.h:122:48: warning: passing argument 1 of ‘_zval_ptr_dtor’ from incompatible pointer type [-Wincompatible-pointer-types]
#define zval_ptr_dtor(zval_ptr) _zval_ptr_dtor((zval_ptr) ZEND_FILE_LINE_CC)
^
/tmp/pear/temp/Mosquitto/mosquitto.c:1176:3: note: in expansion of macro ‘zval_ptr_dtor’
zval_ptr_dtor(&retval_ptr);
^
/usr/include/php/20151012/Zend/zend_variables.h:112:15: note: expected ‘zval * {aka struct zval_struct *}’ but argument is of type ‘zval * {aka struct zval_struct *}’
ZEND_API void zval_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC);
^
/tmp/pear/temp/Mosquitto/mosquitto.c: In function ‘php_mosquitto_unsubscribe_callback’:
/tmp/pear/temp/Mosquitto/mosquitto.c:1198:38: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
object->unsubscribe_callback.params = params;
^
/tmp/pear/temp/Mosquitto/mosquitto.c:1200:30: error: ‘zend_fcall_info {aka struct zend_fcall_info}’ has no member named ‘retval_ptr_ptr’
object->unsubscribe_callback.retval_ptr_ptr = &retval_ptr;
^
In file included from /usr/include/php/20151012/Zend/zend.h:35:0,
from /usr/include/php/20151012/main/php.h:36,
from /tmp/pear/temp/Mosquitto/mosquitto.c:5:
/usr/include/php/20151012/Zend/zend_types.h:516:39: error: invalid type argument of unary ‘
’ (have ‘zval {aka struct zval_struct}’)
#define Z_STRVAL_P(zval_p) Z_STRVAL(
(zval_p))
^
/usr/include/php/20151012/Zend/zend_string.h:40:26: note: in definition of macro ‘ZSTR_VAL’
#define ZSTR_VAL(zstr) (zstr)->val
^
/usr/include/php/20151012/Zend/zend_types.h:515:36: note: in expansion of macro ‘Z_STR’
#define Z_STRVAL(zval) ZSTR_VAL(Z_STR(zval))
^
/usr/include/php/20151012/Zend/zend_types.h:516:30: note: in expansion of macro ‘Z_STRVAL’
#define Z_STRVAL_P(zval_p) Z_STRVAL(
(zval_p))
^
/tmp/pear/temp/Mosquitto/mosquitto.c:1204:111: note: in expansion of macro ‘Z_STRVAL_P’
zend_throw_exception_ex(mosquitto_ce_exception, 0 TSRMLS_CC, "Failed to invoke unsubscribe callback %s()", Z_STRVAL_P(object->unsubscribe_callback.function_name));
^
In file included from /usr/include/php/20151012/Zend/zend.h:39:0,
from /usr/include/php/20151012/main/php.h:36,
from /tmp/pear/temp/Mosquitto/mosquitto.c:5:
/usr/include/php/20151012/Zend/zend_variables.h:122:48: warning: passing argument 1 of ‘_zval_ptr_dtor’ from incompatible pointer type [-Wincompatible-pointer-types]
#define zval_ptr_dtor(zval_ptr) _zval_ptr_dtor((zval_ptr) ZEND_FILE_LINE_CC)
^
/tmp/pear/temp/Mosquitto/mosquitto.c:1208:2: note: in expansion of macro ‘zval_ptr_dtor’
zval_ptr_dtor(params[0]);
^
/usr/include/php/20151012/Zend/zend_variables.h:112:15: note: expected ‘zval * {aka struct _zval_struct }’ but argument is of type ‘zval * {aka struct zval_struct *}’
ZEND_API void _zval_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC);
^
/usr/include/php/20151012/Zend/zend_variables.h:122:48: warning: passing argument 1 of ‘_zval_ptr_dtor’ from incompatible pointer type [-Wincompatible-pointer-types]
#define zval_ptr_dtor(zval_ptr) _zval_ptr_dtor((zval_ptr) ZEND_FILE_LINE_CC)
^
/tmp/pear/temp/Mosquitto/mosquitto.c:1211:3: note: in expansion of macro ‘zval_ptr_dtor’
zval_ptr_dtor(&retval_ptr);
^
/usr/include/php/20151012/Zend/zend_variables.h:112:15: note: expected ‘zval * {aka struct zval_struct *}’ but argument is of type ‘zval * {aka struct zval_struct *}’
ZEND_API void zval_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC);
^
/tmp/pear/temp/Mosquitto/mosquitto.c: In function ‘zm_startup_mosquitto’:
/tmp/pear/temp/Mosquitto/mosquitto.c:1302:24: error: too many arguments to function ‘zend_register_internal_class_ex’
mosquitto_ce_client = zend_register_internal_class_ex(&client_ce, NULL, NULL TSRMLS_CC);
^
In file included from /usr/include/php/20151012/main/php.h:40:0,
from /tmp/pear/temp/Mosquitto/mosquitto.c:5:
/usr/include/php/20151012/Zend/zend_API.h:290:28: note: declared here
ZEND_API zend_class_entry *zend_register_internal_class_ex(zend_class_entry *class_entry, zend_class_entry *parent_ce);
^
/tmp/pear/temp/Mosquitto/mosquitto.c:1303:37: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
mosquitto_ce_client->create_object = mosquitto_client_object_new;
^
/tmp/pear/temp/Mosquitto/mosquitto.c:1306:27: error: too many arguments to function ‘zend_register_internal_class_ex’
mosquitto_ce_exception = zend_register_internal_class_ex(&exception_ce,
^
In file included from /usr/include/php/20151012/main/php.h:40:0,
from /tmp/pear/temp/Mosquitto/mosquitto.c:5:
/usr/include/php/20151012/Zend/zend_API.h:290:28: note: declared here
ZEND_API zend_class_entry *zend_register_internal_class_ex(zend_class_entry *class_entry, zend_class_entry *parent_ce);
^
Makefile:194: recipe for target 'mosquitto.lo' failed
make: *
* [mosquitto.lo] Error 1
ERROR: `make' failed

Message not fired when QoS = 2

In the code the message is not received when the QoS is set to 2.. it is when 0 or 1 but not 2

$c = new Mosquitto\Client('myClient');
$c->onConnect(function() use ($c) {
$c->publish('xxx/yyy/v1.0/zzz', "{ 'battery' : 11 }", 2,false);
$c->disconnect();
});

$c->connect('localhost', 1883, 5);

// Loop around to permit the library to do its work
// This function will call the callback defined in onConnect()
// and disconnect cleanly when the message has been sent
$c->loopForever();

when the epcl package is updated?

Hi all,

I see on the Issues a lot of bugs with theirs solution.
Do you know when the package pecl on linux is updated to have all bug fixes?

thanks a lot for your work!
GF

PHP 7 Segmentation Fault

Hi.

I noticed that if I compile Mosquitto-PHP under a PHP 7.0 environment, some random bugs occur when running example scripts.

When I create a basic subscriber, the php script randomly crash segmentation fault. I used example scripts and tested to fix em without success.

I tested both cases under clean Debian 9 installations.

But under a full PHP5.6 environnement, everything works fine, with libmosquittlo-dev 1.4.3. Mosquitto-php seems not compliant with PHP7.

New PHP 7 SegFault

This segfaults on PHP 7.0.12 (default php.ini) with Mosquitto-PHP master on second publish to /ping/test with payload of "1"

<?php
function print_nl($x) { print $x.PHP_EOL; }
$SUB = new Mosquitto\Client(uniqid(), false);
$SUB->setCredentials("user", "pass");
$SUB->connect("127.0.0.1", 1883);
$SUB->subscribe("/ping/test", 0);
$SUB->onMessage(function($message) {
 print_nl(memory_get_usage());
 print_r($message);
 print_nl("Received PING from from worker monitor. Performing worker checks...");
});
while(true) {
 try { $SUB->loop(5); } catch(Exception $e) { print_nl("Caught exception."); }
}

Changing to
print_nl("Received PING from from worker monitor.");
does not

(gdb) run test.php
Starting program: /usr/bin/php test.php
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
1221744
Mosquitto\Message Object
(
    [mid] => 0
    [topic] => /ping/test
    [payload] => 1
    [qos] => 0
    [retain] => 
)
Received PING from from worker monitor. Performing worker checks...
1221680
Mosquitto\Message Object
(
    [mid] => 0
    [topic] => /ping/test
    [payload] => 1
    [qos] => 0
    [retain] => 
)
Received PING from from worker monitor. Performing worker checks...

Program received signal SIGSEGV, Segmentation fault.
0x00005555557f3fcb in zend_objects_store_del ()
(gdb) bt
#0  0x00005555557f3fcb in zend_objects_store_del ()
#1  0x00007ffff161695d in php_mosquitto_message_callback (mosq=<optimized out>, client_obj=0x7ffff5f44500, message=0x555555d9a0a8) at /usr/src/Mosquitto-PHP/mosquitto.c:1171
#2  0x00007ffff1409465 in ?? () from /usr/lib/x86_64-linux-gnu/libmosquitto.so.1
#3  0x00007ffff14088e6 in ?? () from /usr/lib/x86_64-linux-gnu/libmosquitto.so.1
#4  0x00007ffff1406105 in mosquitto_loop_read () from /usr/lib/x86_64-linux-gnu/libmosquitto.so.1
#5  0x00007ffff1406530 in ?? () from /usr/lib/x86_64-linux-gnu/libmosquitto.so.1
#6  0x00007ffff161890a in zim_Mosquitto_Client_loop (execute_data=0x7ffff5e13160, return_value=<optimized out>) at /usr/src/Mosquitto-PHP/mosquitto.c:777
#7  0x00005555557a795a in dtrace_execute_internal ()
#8  0x000055555583ca90 in ?? ()
#9  0x00005555557f7e1b in execute_ex ()
#10 0x00005555557a77e8 in dtrace_execute_ex ()
#11 0x000055555584c8e7 in zend_execute ()
#12 0x00005555557b7b63 in zend_execute_scripts ()
#13 0x0000555555757f1b in php_execute_script ()
#14 0x000055555584e59a in ?? ()
#15 0x000055555563cfed in main ()

I don't know enough about Zend to track this down. Anyone have any ideas?

Also, any idea why is mid always 0?

Examples/event.php will pop a warning after certain time

I am testing the Mosquitto-PHP with the event.php example,. Unfortunately, I found that the script will pop up an PHP Waring after running awhile (a minute or two), no matter it have received a message or not, and will be stopped to received message after the warning. The warning is:

PHP Warning: EventBase::dispatch(): An error occurred while invoking the callback in /path/to/mosquitto/examples/event.php on line 27"

I have checked the Apache error.log and confirmed that there is no error there. But I don't known which log file stored errors for PHP CLI mode.

I am not familiar with libevent or PHP Event extension. As the callback is quite sample, I wonder why it will become hang for running awhile.

Cannot install (make error)

I tried to install Mosquitto PHP either with PECL or with manual compilation on an Ubuntu 12.04 64bit machine and in both cases it stops during the make command.

Those are the last lines of "make" output:

/home/mirko/libraries/mosquittophp/mosquitto.c: In function 'zim_Mosquitto_Client_publish':
/home/mirko/libraries/mosquittophp/mosquitto.c:662:2: warning: passing argument 2 of 'mosquitto_publish' from incompatible pointer type [enabled by default]
/usr/include/mosquitto.h:395:20: note: expected 'uint16_t ' but argument is of type 'int *'
/home/mirko/libraries/mosquittophp/mosquitto.c: In function 'zim_Mosquitto_Client_subscribe':
/home/mirko/libraries/mosquittophp/mosquitto.c:687:2: warning: passing argument 2 of 'mosquitto_subscribe' from incompatible pointer type [enabled by default]
/usr/include/mosquitto.h:417:20: note: expected 'uint16_t *' but argument is of type 'int *'
/home/mirko/libraries/mosquittophp/mosquitto.c: In function 'zim_Mosquitto_Client_unsubscribe':
/home/mirko/libraries/mosquittophp/mosquitto.c:711:2: warning: passing argument 2 of 'mosquitto_unsubscribe' from incompatible pointer type [enabled by default]
/usr/include/mosquitto.h:438:20: note: expected 'uint16_t *' but argument is of type 'int *'
/home/mirko/libraries/mosquittophp/mosquitto.c: In function 'zim_Mosquitto_Client_loop':
/home/mirko/libraries/mosquittophp/mosquitto.c:734:2: error: too many arguments to function 'mosquitto_loop'
/usr/include/mosquitto.h:503:20: note: declared here
/home/mirko/libraries/mosquittophp/mosquitto.c: In function 'mosquitto_client_object_destroy':
/home/mirko/libraries/mosquittophp/mosquitto.c:792:2: error: too many arguments to function 'mosquitto_loop'
/usr/include/mosquitto.h:503:20: note: declared here
/home/mirko/libraries/mosquittophp/mosquitto.c: In function 'php_mosquitto_handle_errno':
/home/mirko/libraries/mosquittophp/mosquitto.c:843:12: warning: assignment makes pointer from integer without a cast [enabled by default]
/home/mirko/libraries/mosquittophp/mosquitto.c: In function 'php_mosquitto_connect_callback':
/home/mirko/libraries/mosquittophp/mosquitto.c:868:10: warning: assignment makes pointer from integer without a cast [enabled by default]
make: *
* [mosquitto.lo] Error 1

I used /usr/lib/libmosquitto.so.0 , I cannot install libmoquitto 1.2 due to broken dependencies on Ubuntu 12.04.

Any idea why it fails and what should I do?

OnConnect function does not get the status of the mosquito server

Here is the code

<?php
$client = new Mosquitto\Client();
$client->onConnect(function ($rc,$message) {
print_r($rc);
});
try {
$client->connect("127.0.0.1", 1883);
$client->subscribe('test', 1);
while(true) {
$client->loopForever();
sleep(2);
}
} catch (Mosquitto\Exception $e) {
print_r($e);
}

When the mosquito server is not available, the connect method throws a Mosquitto\Exception. But the onConnect callback function can not get codes Response. So how do I get the status of the mosquito server?

can it support apache apollo?

can it support apache apollo?

in apache apolle ,will print
Fatal error: Uncaught exception 'Mosquitto\Exception' with message 'The connection was lost.' in /Library/WebServer/Documents/phpmosquitto/test.php on line 14

Installation Issue

Please provide the prefix of the libmosquitto installation [autodetect] :

what should I provide here? Tried different things, same result finally as follows
.........
checking for mosquitto files in default path... not found
configure: error: Please reinstall the mosquitto distribution
ERROR: `/var/tmp/Mosquitto/configure --with-mosquitto=xyz failed

mac install error

Hi,
my env is

  • mac osx 10.11
  • php7.0.8

$sudo ./pecl install mosquitto-beta
downloading Mosquitto-0.3.0.tgz ...
Starting to download Mosquitto-0.3.0.tgz (25,395 bytes)
.....done: 25,395 bytes
5 source files, building
running: phpize
Configuring for:
PHP Api Version: 20151012
Zend Module Api No: 20151012
Zend Extension Api No: 320151012
Please provide the prefix of the libmosquitto installation [autodetect] :
building in /private/tmp/pear/install/pear-build-roott4eHWD/Mosquitto-0.3.0
running: /private/tmp/pear/install/Mosquitto/configure --with-php-config=/usr/local/bin/php-config --with-mosquitto
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-apple-darwin15.6.0
checking host system type... x86_64-apple-darwin15.6.0
checking target system type... x86_64-apple-darwin15.6.0
checking for PHP prefix... /usr/local/Cellar/php70/7.0.10_1
checking for PHP includes... -I/usr/local/Cellar/php70/7.0.10_1/include/php -I/usr/local/Cellar/php70/7.0.10_1/include/php/main -I/usr/local/Cellar/php70/7.0.10_1/include/php/TSRM -I/usr/local/Cellar/php70/7.0.10_1/include/php/Zend -I/usr/local/Cellar/php70/7.0.10_1/include/php/ext -I/usr/local/Cellar/php70/7.0.10_1/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/Cellar/php70/7.0.10_1/lib/php/extensions/no-debug-non-zts-20151012
checking for PHP installed headers prefix... /usr/local/Cellar/php70/7.0.10_1/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... no
checking for nawk... no
checking for awk... awk
checking if awk is broken... no
checking for mosquitto support... yes, shared
checking for mosquitto files in default path... checking /usr/local... found in /usr/local
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking whether strerror_r is declared... yes
checking for strerror_r... yes
checking whether strerror_r returns char *... no
checking for ld used by cc... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no
checking for /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 196608
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking if cc supports -fno-rtti -fno-exceptions... yes
checking for cc option to produce PIC... -fno-common
checking if cc PIC flag -fno-common works... yes
checking if cc static flag -static works... no
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin15.6.0 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
running: make
/bin/sh /private/tmp/pear/install/pear-build-roott4eHWD/Mosquitto-0.3.0/libtool --mode=compile cc -I. -I/private/tmp/pear/install/Mosquitto -DPHP_ATOM_INC -I/private/tmp/pear/install/pear-build-roott4eHWD/Mosquitto-0.3.0/include -I/private/tmp/pear/install/pear-build-roott4eHWD/Mosquitto-0.3.0/main -I/private/tmp/pear/install/Mosquitto -I/usr/local/Cellar/php70/7.0.10_1/include/php -I/usr/local/Cellar/php70/7.0.10_1/include/php/main -I/usr/local/Cellar/php70/7.0.10_1/include/php/TSRM -I/usr/local/Cellar/php70/7.0.10_1/include/php/Zend -I/usr/local/Cellar/php70/7.0.10_1/include/php/ext -I/usr/local/Cellar/php70/7.0.10_1/include/php/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -c /private/tmp/pear/install/Mosquitto/mosquitto.c -o mosquitto.lo
mkdir .libs
cc -I. -I/private/tmp/pear/install/Mosquitto -DPHP_ATOM_INC -I/private/tmp/pear/install/pear-build-roott4eHWD/Mosquitto-0.3.0/include -I/private/tmp/pear/install/pear-build-roott4eHWD/Mosquitto-0.3.0/main -I/private/tmp/pear/install/Mosquitto -I/usr/local/Cellar/php70/7.0.10_1/include/php -I/usr/local/Cellar/php70/7.0.10_1/include/php/main -I/usr/local/Cellar/php70/7.0.10_1/include/php/TSRM -I/usr/local/Cellar/php70/7.0.10_1/include/php/Zend -I/usr/local/Cellar/php70/7.0.10_1/include/php/ext -I/usr/local/Cellar/php70/7.0.10_1/include/php/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -c /private/tmp/pear/install/Mosquitto/mosquitto.c -fno-common -DPIC -o .libs/mosquitto.o
/private/tmp/pear/install/Mosquitto/mosquitto.c:114:39: warning: implicit declaration of function 'zend_object_store_get_object' is invalid in C99 [-Wimplicit-function-declaration]
object = (mosquitto_client_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
^
/private/tmp/pear/install/Mosquitto/mosquitto.c:114:11: warning: cast to 'mosquitto_client_object *' (aka 'struct _mosquitto_client_object *') from smaller integer type 'int' [-Wint-to-pointer-cast]
object = (mosquitto_client_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
^
/private/tmp/pear/install/Mosquitto/mosquitto.c:159:11: warning: cast to 'mosquitto_client_object *' (aka 'struct _mosquitto_client_object *') from smaller integer type 'int' [-Wint-to-pointer-cast]
object = (mosquitto_client_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
^
/private/tmp/pear/install/Mosquitto/mosquitto.c:162:11: warning: implicit declaration of function 'Z_BVAL' is invalid in C99 [-Wimplicit-function-declaration]
is_dir = Z_BVAL(stat);
^
/private/tmp/pear/install/Mosquitto/mosquitto.c:195:11: warning: cast to 'mosquitto_client_object *' (aka 'struct _mosquitto_client_object *') from smaller integer type 'int' [-Wint-to-pointer-cast]
object = (mosquitto_client_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
^
/private/tmp/pear/install/Mosquitto/mosquitto.c:222:11: warning: cast to 'mosquitto_client_object *' (aka 'struct _mosquitto_client_object *') from smaller integer type 'int' [-Wint-to-pointer-cast]
object = (mosquitto_client_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
^
/private/tmp/pear/install/Mosquitto/mosquitto.c:247:11: warning: cast to 'mosquitto_client_object *' (aka 'struct _mosquitto_client_object *') from smaller integer type 'int' [-Wint-to-pointer-cast]
object = (mosquitto_client_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
^
/private/tmp/pear/install/Mosquitto/mosquitto.c:421:13: error: passing 'zval' (aka 'struct _zval_struct') to parameter of incompatible type 'zval *' (aka 'struct _zval_struct *'); take the address with &
Z_ADDREF_P(connect_callback.function_name);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
&
/usr/local/Cellar/php70/7.0.10_1/include/php/Zend/zend_types.h:787:41: note: expanded from macro 'Z_ADDREF_P'

define Z_ADDREF_P(pz) zval_addref_p(pz)

                                                          ^~

/usr/local/Cellar/php70/7.0.10_1/include/php/Zend/zend_types.h:820:56: note: passing argument to parameter 'pz' here
static zend_always_inline uint32_t zval_addref_p(zval* pz) {
^
/private/tmp/pear/install/Mosquitto/mosquitto.c:423:23: error: no member named 'object_ptr' in 'struct _zend_fcall_info'
if (connect_callback.object_ptr != NULL) {
~~~~~~~~~~~~~~~~ ^
/private/tmp/pear/install/Mosquitto/mosquitto.c:424:31: error: no member named 'object_ptr' in 'struct _zend_fcall_info'
Z_ADDREF_P(connect_callback.object_ptr);
~~~~~~~~~~~~~~~~ ^
/usr/local/Cellar/php70/7.0.10_1/include/php/Zend/zend_types.h:787:41: note: expanded from macro 'Z_ADDREF_P'

define Z_ADDREF_P(pz) zval_addref_p(pz)

                                                          ^~

/private/tmp/pear/install/Mosquitto/mosquitto.c:455:13: error: passing 'zval' (aka 'struct _zval_struct') to parameter of incompatible type 'zval *' (aka 'struct _zval_struct *'); take the address with &
Z_ADDREF_P(disconnect_callback.function_name);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
&
/usr/local/Cellar/php70/7.0.10_1/include/php/Zend/zend_types.h:787:41: note: expanded from macro 'Z_ADDREF_P'

define Z_ADDREF_P(pz) zval_addref_p(pz)

                                                          ^~

/usr/local/Cellar/php70/7.0.10_1/include/php/Zend/zend_types.h:820:56: note: passing argument to parameter 'pz' here
static zend_always_inline uint32_t zval_addref_p(zval* pz) {
^
/private/tmp/pear/install/Mosquitto/mosquitto.c:457:26: error: no member named 'object_ptr' in 'struct _zend_fcall_info'
if (disconnect_callback.object_ptr != NULL) {
~~~~~~~~~~~~~~~~~~~ ^
/private/tmp/pear/install/Mosquitto/mosquitto.c:458:34: error: no member named 'object_ptr' in 'struct _zend_fcall_info'
Z_ADDREF_P(disconnect_callback.object_ptr);
~~~~~~~~~~~~~~~~~~~ ^
/usr/local/Cellar/php70/7.0.10_1/include/php/Zend/zend_types.h:787:41: note: expanded from macro 'Z_ADDREF_P'

define Z_ADDREF_P(pz) zval_addref_p(pz)

                                                          ^~

/private/tmp/pear/install/Mosquitto/mosquitto.c:489:13: error: passing 'zval' (aka 'struct _zval_struct') to parameter of incompatible type 'zval *' (aka 'struct _zval_struct *'); take the address with &
Z_ADDREF_P(log_callback.function_name);
^~~~~~~~~~~~~~~~~~~~~~~~~~
&
/usr/local/Cellar/php70/7.0.10_1/include/php/Zend/zend_types.h:787:41: note: expanded from macro 'Z_ADDREF_P'

define Z_ADDREF_P(pz) zval_addref_p(pz)

                                                          ^~

/usr/local/Cellar/php70/7.0.10_1/include/php/Zend/zend_types.h:820:56: note: passing argument to parameter 'pz' here
static zend_always_inline uint32_t zval_addref_p(zval* pz) {
^
/private/tmp/pear/install/Mosquitto/mosquitto.c:491:19: error: no member named 'object_ptr' in 'struct _zend_fcall_info'
if (log_callback.object_ptr != NULL) {
~~~~~~~~~~~~ ^
/private/tmp/pear/install/Mosquitto/mosquitto.c:492:27: error: no member named 'object_ptr' in 'struct _zend_fcall_info'
Z_ADDREF_P(log_callback.object_ptr);
~~~~~~~~~~~~ ^
/usr/local/Cellar/php70/7.0.10_1/include/php/Zend/zend_types.h:787:41: note: expanded from macro 'Z_ADDREF_P'

define Z_ADDREF_P(pz) zval_addref_p(pz)

                                                          ^~

/private/tmp/pear/install/Mosquitto/mosquitto.c:523:13: error: passing 'zval' (aka 'struct _zval_struct') to parameter of incompatible type 'zval *' (aka 'struct _zval_struct *'); take the address with &
Z_ADDREF_P(subscribe_callback.function_name);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
&
/usr/local/Cellar/php70/7.0.10_1/include/php/Zend/zend_types.h:787:41: note: expanded from macro 'Z_ADDREF_P'

define Z_ADDREF_P(pz) zval_addref_p(pz)

                                                          ^~

/usr/local/Cellar/php70/7.0.10_1/include/php/Zend/zend_types.h:820:56: note: passing argument to parameter 'pz' here
static zend_always_inline uint32_t zval_addref_p(zval* pz) {
^
/private/tmp/pear/install/Mosquitto/mosquitto.c:525:25: error: no member named 'object_ptr' in 'struct _zend_fcall_info'
if (subscribe_callback.object_ptr != NULL) {
~~~~~~~~~~~~~~~~~~ ^
/private/tmp/pear/install/Mosquitto/mosquitto.c:526:33: error: no member named 'object_ptr' in 'struct _zend_fcall_info'
Z_ADDREF_P(subscribe_callback.object_ptr);
~~~~~~~~~~~~~~~~~~ ^
/usr/local/Cellar/php70/7.0.10_1/include/php/Zend/zend_types.h:787:41: note: expanded from macro 'Z_ADDREF_P'

define Z_ADDREF_P(pz) zval_addref_p(pz)

                                                          ^~

/private/tmp/pear/install/Mosquitto/mosquitto.c:557:13: error: passing 'zval' (aka 'struct _zval_struct') to parameter of incompatible type 'zval *' (aka 'struct _zval_struct *'); take the address with &
Z_ADDREF_P(unsubscribe_callback.function_name);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
&
/usr/local/Cellar/php70/7.0.10_1/include/php/Zend/zend_types.h:787:41: note: expanded from macro 'Z_ADDREF_P'

define Z_ADDREF_P(pz) zval_addref_p(pz)

                                                          ^~

/usr/local/Cellar/php70/7.0.10_1/include/php/Zend/zend_types.h:820:56: note: passing argument to parameter 'pz' here
static zend_always_inline uint32_t zval_addref_p(zval* pz) {
^
/private/tmp/pear/install/Mosquitto/mosquitto.c:559:27: error: no member named 'object_ptr' in 'struct _zend_fcall_info'
if (unsubscribe_callback.object_ptr != NULL) {
~~~~~~~~~~~~~~~~~~~~ ^
/private/tmp/pear/install/Mosquitto/mosquitto.c:560:35: error: no member named 'object_ptr' in 'struct _zend_fcall_info'
Z_ADDREF_P(unsubscribe_callback.object_ptr);
~~~~~~~~~~~~~~~~~~~~ ^
/usr/local/Cellar/php70/7.0.10_1/include/php/Zend/zend_types.h:787:41: note: expanded from macro 'Z_ADDREF_P'

define Z_ADDREF_P(pz) zval_addref_p(pz)

                                                          ^~

/private/tmp/pear/install/Mosquitto/mosquitto.c:591:13: error: passing 'zval' (aka 'struct _zval_struct') to parameter of incompatible type 'zval *' (aka 'struct _zval_struct *'); take the address with &
Z_ADDREF_P(message_callback.function_name);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
&
/usr/local/Cellar/php70/7.0.10_1/include/php/Zend/zend_types.h:787:41: note: expanded from macro 'Z_ADDREF_P'

define Z_ADDREF_P(pz) zval_addref_p(pz)

                                                          ^~

/usr/local/Cellar/php70/7.0.10_1/include/php/Zend/zend_types.h:820:56: note: passing argument to parameter 'pz' here
static zend_always_inline uint32_t zval_addref_p(zval* pz) {
^
/private/tmp/pear/install/Mosquitto/mosquitto.c:593:23: error: no member named 'object_ptr' in 'struct _zend_fcall_info'
if (message_callback.object_ptr != NULL) {
~~~~~~~~~~~~~~~~ ^
/private/tmp/pear/install/Mosquitto/mosquitto.c:594:31: error: no member named 'object_ptr' in 'struct _zend_fcall_info'
Z_ADDREF_P(message_callback.object_ptr);
~~~~~~~~~~~~~~~~ ^
/usr/local/Cellar/php70/7.0.10_1/include/php/Zend/zend_types.h:787:41: note: expanded from macro 'Z_ADDREF_P'

define Z_ADDREF_P(pz) zval_addref_p(pz)

                                                          ^~

/private/tmp/pear/install/Mosquitto/mosquitto.c:625:13: error: passing 'zval' (aka 'struct _zval_struct') to parameter of incompatible type 'zval *' (aka 'struct _zval_struct *'); take the address with &
Z_ADDREF_P(publish_callback.function_name);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
&
/usr/local/Cellar/php70/7.0.10_1/include/php/Zend/zend_types.h:787:41: note: expanded from macro 'Z_ADDREF_P'

define Z_ADDREF_P(pz) zval_addref_p(pz)

                                                          ^~

/usr/local/Cellar/php70/7.0.10_1/include/php/Zend/zend_types.h:820:56: note: passing argument to parameter 'pz' here
static zend_always_inline uint32_t zval_addref_p(zval* pz) {
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
7 warnings and 20 errors generated.
make: *** [mosquitto.lo] Error 1
ERROR: `make' failed

php7 branch: SegFault when calling ->connect()

Hi, we are getting SegFault signal and the backtrace from gdb says:

Program terminated with signal 11, Segmentation fault.
#0  zend_vm_stack_push_call_frame_ex (execute_data=0x7f6c02013030) at /usr/src/php-7.0.6/Zend/zend_execute.h:181
181                     ZEND_SET_CALL_INFO(call, call_info);

Here is backtrace:

#8  0x00000000007e3216 in main (argc=2, argv=0x1d8aa30) at /usr/src/php-7.0.6/sapi/cli/php_cli.c:1344
1344                            exit_status = do_cli(argc, argv);
#7  0x00000000007e2a9e in do_cli (argc=2, argv=0x1d8aa30) at /usr/src/php-7.0.6/sapi/cli/php_cli.c:974
974                                     php_execute_script(&file_handle);
#6  0x00000000006f3b98 in php_execute_script (primary_file=0x7ffe154f3a50) at /usr/src/php-7.0.6/main/main.c:2494
2494                            retval = (zend_execute_scripts(ZEND_REQUIRE, NULL, 3, prepend_file_p, primary_file, append_file_p) == SUCCESS);
#5  0x000000000074f8d7 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /usr/src/php-7.0.6/Zend/zend.c:1427
1427                            zend_execute(op_array, retval);
#4  0x00000000007de9f3 in zend_execute (op_array=0x7f6c0207d000, return_value=<value optimized out>) at /usr/src/php-7.0.6/Zend/zend_vm_execute.h:458
458             zend_execute_ex(execute_data);
#3  0x000000000078de40 in execute_ex (ex=<value optimized out>) at /usr/src/php-7.0.6/Zend/zend_vm_execute.h:417
417                     if (UNEXPECTED((ret = ((opcode_handler_t)OPLINE->handler)(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU)) != 0))                                                                                         {
#2  ZEND_INIT_METHOD_CALL_SPEC_CV_CONST_HANDLER (execute_data=0x7f6c02013030) at /usr/src/php-7.0.6/Zend/zend_vm_execute.h:32123
32123           call = zend_vm_stack_push_call_frame(call_info,
#1  zend_vm_stack_push_call_frame (execute_data=0x7f6c02013030) at /usr/src/php-7.0.6/Zend/zend_execute.h:207
207             return zend_vm_stack_push_call_frame_ex(used_stack, call_info,
#0  zend_vm_stack_push_call_frame_ex (execute_data=0x7f6c02013030) at /usr/src/php-7.0.6/Zend/zend_execute.h:181
181                     ZEND_SET_CALL_INFO(call, call_info);

Correlate log level integer to string

I looked through the documentation and the source code, and I can't figure out what the integer representation of the following constants referenced in your documentation:

constant LOG_DEBUG
Identifies a debug-level log message

constant LOG_INFO
Identifies an info-level log message

constant LOG_NOTICE
Identifies a notice-level log message

constant LOG_WARNING
Identifies a warning-level log message

constant LOG_ERR
Identifies an error-level log message

In essence, when a level of 16 is returned, does that mean LOG_DEBUG?

It does not appear that you're following PSR-3 for logging which is based off RFC-5424. If you were, the numerical coding for your log types would be as they're described on page 11:


           Numerical         Severity
             Code

              0       Emergency: system is unusable
              1       Alert: action must be taken immediately
              2       Critical: critical conditions
              3       Error: error conditions
              4       Warning: warning conditions
              5       Notice: normal but significant condition
              6       Informational: informational messages
              7       Debug: debug-level messages

Can not install on Ubuntu 12.04 with Mosquite 3.1

||/ Name Version Description
+++-============================-============================-========================================================================
ii libmosquitto0 0.15-0ubuntu1.12.04.1 MQTT version 3.1 client library
ii libmosquitto0-dev 0.15-0ubuntu1.12.04.1 MQTT version 3.1 client library, development files
ii mosquitto-clients 0.15-0ubuntu1.12.04.1 Mosquitto command line MQTT clients

$ sudo pecl install Mosquitto-alpha
downloading Mosquitto-0.2.1.tgz ...
Starting to download Mosquitto-0.2.1.tgz (15,958 bytes)
......done: 15,958 bytes
4 source files, building
running: phpize
Configuring for:
PHP Api Version: 20121113
Zend Module Api No: 20121212
Zend Extension Api No: 220121212
Please provide the prefix of the libmosquitto installation [autodetect] :
building in /tmp/pear/temp/pear-build-rootEO3vH6/Mosquitto-0.2.1
running: /tmp/pear/temp/Mosquitto/configure --with-mosquitto
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib
checking for PHP extension directory... /usr/lib/php5/20121212
checking for PHP installed headers prefix... /usr/include/php5
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... no
checking for nawk... nawk
checking if nawk is broken... no
checking for mosquitto support... yes, shared
checking for mosquitto files in default path... checking /usr... found in /usr
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking whether strerror_r is declared... yes
checking for strerror_r... yes
checking whether strerror_r returns char ... no
checking how to print strings... printf
checking for a sed that does not truncate output... (cached) /bin/sed
checking for fgrep... /bin/grep -F
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @file support... @
checking for strip... strip
checking for ranlib... ranlib
checking for gawk... (cached) nawk
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for sysroot... no
checking for mt... mt
checking if mt is a manifest tool... no
checking for dlfcn.h... yes
checking for objdir... .libs
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC -DPIC
checking if cc PIC flag -fPIC -DPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking if cc supports -c -o file.o... (cached) yes
checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
configure: creating ./config.status
config.status: creating config.h
config.status: executing libtool commands
running: make
/bin/bash /tmp/pear/temp/pear-build-rootEO3vH6/Mosquitto-0.2.1/libtool --mode=compile cc -I. -I/tmp/pear/temp/Mosquitto -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootEO3vH6/Mosquitto-0.2.1/include -I/tmp/pear/temp/pear-build-rootEO3vH6/Mosquitto-0.2.1/main -I/tmp/pear/temp/Mosquitto -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/Mosquitto/mosquitto.c -o mosquitto.lo
libtool: compile: cc -I. -I/tmp/pear/temp/Mosquitto -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootEO3vH6/Mosquitto-0.2.1/include -I/tmp/pear/temp/pear-build-rootEO3vH6/Mosquitto-0.2.1/main -I/tmp/pear/temp/Mosquitto -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/Mosquitto/mosquitto.c -fPIC -DPIC -o .libs/mosquitto.o
/tmp/pear/temp/Mosquitto/mosquitto.c: In function 'zim_Mosquitto_Client___construct':
/tmp/pear/temp/Mosquitto/mosquitto.c:111:2: warning: passing argument 2 of 'mosquitto_new' makes pointer from integer without a cast [enabled by default]
/usr/include/mosquitto.h:196:34: note: expected 'void *' but argument is of type 'zend_bool'
/tmp/pear/temp/Mosquitto/mosquitto.c:111:2: error: too many arguments to function 'mosquitto_new'
/usr/include/mosquitto.h:196:34: note: declared here
/tmp/pear/temp/Mosquitto/mosquitto.c: In function 'zim_Mosquitto_Client_setWill':
/tmp/pear/temp/Mosquitto/mosquitto.c:284:2: warning: passing argument 3 of 'mosquitto_will_set' makes pointer from integer without a cast [enabled by default]
/usr/include/mosquitto.h:268:20: note: expected 'const char *' but argument is of type 'int'
/tmp/pear/temp/Mosquitto/mosquitto.c:284:2: warning: passing argument 4 of 'mosquitto_will_set' makes integer from pointer without a cast [enabled by default]
/usr/include/mosquitto.h:268:20: note: expected 'uint32_t' but argument is of type 'void *'
/tmp/pear/temp/Mosquitto/mosquitto.c:284:2: warning: passing argument 5 of 'mosquitto_will_set' makes pointer from integer without a cast [enabled by default]
/usr/include/mosquitto.h:268:20: note: expected 'const uint8_t *' but argument is of type 'long int'
/tmp/pear/temp/Mosquitto/mosquitto.c:284:2: error: too few arguments to function 'mosquitto_will_set'
/usr/include/mosquitto.h:268:20: note: declared here
/tmp/pear/temp/Mosquitto/mosquitto.c: In function 'zim_Mosquitto_Client_connect':
/tmp/pear/temp/Mosquitto/mosquitto.c:355:3: error: too few arguments to function 'mosquitto_connect'
/usr/include/mosquitto.h:322:20: note: declared here
/tmp/pear/temp/Mosquitto/mosquitto.c: In function 'zim_Mosquitto_Client_onConnect':
/tmp/pear/temp/Mosquitto/mosquitto.c:418:2: warning: passing argument 2 of 'mosquitto_connect_callback_set' from incompatible pointer type [enabled by default]
/usr/include/mosquitto.h:618:21: note: expected 'void (
)(void , int)' but argument is of type 'void ()(struct mosquitto , void *, int)'
/tmp/pear/temp/Mosquitto/mosquitto.c: In function 'zim_Mosquitto_Client_onDisconnect':
/tmp/pear/temp/Mosquitto/mosquitto.c:452:2: warning: passing argument 2 of 'mosquitto_disconnect_callback_set' from incompatible pointer type [enabled by default]
/usr/include/mosquitto.h:634:21: note: expected 'void (
)(void )' but argument is of type 'void ()(struct mosquitto , void *, int)'
/tmp/pear/temp/Mosquitto/mosquitto.c: In function 'zim_Mosquitto_Client_onSubscribe':
/tmp/pear/temp/Mosquitto/mosquitto.c:520:2: warning: passing argument 2 of 'mosquitto_subscribe_callback_set' from incompatible pointer type [enabled by default]
/usr/include/mosquitto.h:693:21: note: expected 'void (
)(void , uint16_t, int, const uint8_t *)' but argument is of type 'void ()(struct mosquitto , void *, int, int, const int *)'
/tmp/pear/temp/Mosquitto/mosquitto.c: In function 'zim_Mosquitto_Client_onUnsubscribe':
/tmp/pear/temp/Mosquitto/mosquitto.c:554:2: warning: passing argument 2 of 'mosquitto_unsubscribe_callback_set' from incompatible pointer type [enabled by default]
/usr/include/mosquitto.h:710:21: note: expected 'void (
)(void , uint16_t)' but argument is of type 'void ()(struct mosquitto , void *, int)'
/tmp/pear/temp/Mosquitto/mosquitto.c: In function 'zim_Mosquitto_Client_onMessage':
/tmp/pear/temp/Mosquitto/mosquitto.c:588:2: warning: passing argument 2 of 'mosquitto_message_callback_set' from incompatible pointer type [enabled by default]
/usr/include/mosquitto.h:673:21: note: expected 'void (
)(void , const struct mosquitto_message *)' but argument is of type 'void ()(struct mosquitto , void *, const struct mosquitto_message *)'
/tmp/pear/temp/Mosquitto/mosquitto.c: In function 'zim_Mosquitto_Client_publish':
/tmp/pear/temp/Mosquitto/mosquitto.c:667:2: warning: passing argument 2 of 'mosquitto_publish' from incompatible pointer type [enabled by default]
/usr/include/mosquitto.h:395:20: note: expected 'uint16_t *' but argument is of type 'int *'
/tmp/pear/temp/Mosquitto/mosquitto.c: In function 'zim_Mosquitto_Client_subscribe':
/tmp/pear/temp/Mosquitto/mosquitto.c:692:2: warning: passing argument 2 of 'mosquitto_subscribe' from incompatible pointer type [enabled by default]
/usr/include/mosquitto.h:417:20: note: expected 'uint16_t *' but argument is of type 'int *'
/tmp/pear/temp/Mosquitto/mosquitto.c: In function 'zim_Mosquitto_Client_unsubscribe':
/tmp/pear/temp/Mosquitto/mosquitto.c:716:2: warning: passing argument 2 of 'mosquitto_unsubscribe' from incompatible pointer type [enabled by default]
/usr/include/mosquitto.h:438:20: note: expected 'uint16_t *' but argument is of type 'int *'
/tmp/pear/temp/Mosquitto/mosquitto.c: In function 'zim_Mosquitto_Client_loop':
/tmp/pear/temp/Mosquitto/mosquitto.c:740:2: error: too many arguments to function 'mosquitto_loop'
/usr/include/mosquitto.h:503:20: note: declared here
/tmp/pear/temp/Mosquitto/mosquitto.c: In function 'mosquitto_client_object_destroy':
/tmp/pear/temp/Mosquitto/mosquitto.c:796:2: error: too many arguments to function 'mosquitto_loop'
/usr/include/mosquitto.h:503:20: note: declared here
/tmp/pear/temp/Mosquitto/mosquitto.c: In function 'php_mosquitto_handle_errno':
/tmp/pear/temp/Mosquitto/mosquitto.c:847:12: warning: assignment makes pointer from integer without a cast [enabled by default]
/tmp/pear/temp/Mosquitto/mosquitto.c: In function 'php_mosquitto_connect_callback':
/tmp/pear/temp/Mosquitto/mosquitto.c:872:10: warning: assignment makes pointer from integer without a cast [enabled by default]
make: *
* [mosquitto.lo] Error 1
ERROR: `make' failed

Installing Mosquitto-Alpha

I'm trying to install Mosquito-alpha in order to run your library to connect to a Mosquitto server running on a different machine. It throws a make failed error when installing on ubuntu and can't really progress beyond this.

I've tried installing 'libmosquitto-dev' but this doesn't exist on the Ubuntu repository. There is however 'libmosquitto0-dev' which I have got installed.

I'm running PHP version 5.5.9 and have PECL installed.

Any advice or help would be appreciated. I would really like to get this running. :)

This is a copy of the install with the error thrown
Mosquitto Alpha Install Log.txt

Error on installing extension

I got this error when running make command. I use PHP7. Is there a test version for PHP7?

$ phpize
Configuring for:
PHP Api Version: 20151012
Zend Module Api No: 20151012
Zend Extension Api No: 320151012

$ ./configure --with-mosquitto=/usr/mosquitto
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr/php
checking for PHP includes... -I/usr/php/include/php -I/usr/php/include/php/main -I/usr/php/include/php/TSRM -I/usr/php/include/php/Zend -I/usr/php/include/php/ext -I/usr/php/include/php/ext/date/lib
checking for PHP extension directory... /usr/php/lib/php/extensions/no-debug-non-zts-20151012
checking for PHP installed headers prefix... /usr/php/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... gawk
checking for mosquitto support... yes, shared
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking whether strerror_r is declared... yes
checking for strerror_r... yes
checking whether strerror_r returns char *... no
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 1966080
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC
checking if cc PIC flag -fPIC works... yes
checking if cc static flag -static works... no
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h

$ make
/bin/sh /src/Mosquitto-PHP/libtool --mode=compile cc -I. -I/src/Mosquitto-PHP -DPHP_ATOM_INC -I/src/Mosquitto-PHP/include -I/src/Mosquitto-PHP/main -I/src/Mosquitto-PHP -I/usr/php/include/php -I/usr/php/include/php/main -I/usr/php/include/php/TSRM -I/usr/php/include/php/Zend -I/usr/php/include/php/ext -I/usr/php/include/php/ext/date/lib -I/usr/mosquitto/include -DHAVE_CONFIG_H -g -O2 -c /src/Mosquitto-PHP/mosquitto.c -o mosquitto.lo
mkdir .libs
cc -I. -I/src/Mosquitto-PHP -DPHP_ATOM_INC -I/src/Mosquitto-PHP/include -I/src/Mosquitto-PHP/main -I/src/Mosquitto-PHP -I/usr/php/include/php -I/usr/php/include/php/main -I/usr/php/include/php/TSRM -I/usr/php/include/php/Zend -I/usr/php/include/php/ext -I/usr/php/include/php/ext/date/lib -I/usr/mosquitto/include -DHAVE_CONFIG_H -g -O2 -c /src/Mosquitto-PHP/mosquitto.c -fPIC -DPIC -o .libs/mosquitto.o
/src/Mosquitto-PHP/mosquitto.c: In function ‘zim_Mosquitto_Client___construct’:
/src/Mosquitto-PHP/mosquitto.c:114: warning: cast to pointer from integer of different size
/src/Mosquitto-PHP/mosquitto.c: In function ‘zim_Mosquitto_Client_setTlsCertificates’:
/src/Mosquitto-PHP/mosquitto.c:159: warning: cast to pointer from integer of different size
/src/Mosquitto-PHP/mosquitto.c: In function ‘zim_Mosquitto_Client_setTlsInsecure’:
/src/Mosquitto-PHP/mosquitto.c:195: warning: cast to pointer from integer of different size
/src/Mosquitto-PHP/mosquitto.c: In function ‘zim_Mosquitto_Client_setTlsOptions’:
/src/Mosquitto-PHP/mosquitto.c:222: warning: cast to pointer from integer of different size
/src/Mosquitto-PHP/mosquitto.c: In function ‘zim_Mosquitto_Client_setTlsPSK’:
/src/Mosquitto-PHP/mosquitto.c:247: warning: cast to pointer from integer of different size
/src/Mosquitto-PHP/mosquitto.c: In function ‘zim_Mosquitto_Client_onConnect’:
/src/Mosquitto-PHP/mosquitto.c:421: error: incompatible type for argument 1 of ‘zval_addref_p’
/usr/php/include/php/Zend/zend_types.h:820: note: expected ‘struct zval _’ but argument is of type ‘zval’
/src/Mosquitto-PHP/mosquitto.c:423: error: ‘zend_fcall_info’ has no member named ‘object_ptr’
/src/Mosquitto-PHP/mosquitto.c:424: error: ‘zend_fcall_info’ has no member named ‘object_ptr’
/src/Mosquitto-PHP/mosquitto.c: In function ‘zim_Mosquitto_Client_onDisconnect’:
/src/Mosquitto-PHP/mosquitto.c:455: error: incompatible type for argument 1 of ‘zval_addref_p’
/usr/php/include/php/Zend/zend_types.h:820: note: expected ‘struct zval *’ but argument is of type ‘zval’
/src/Mosquitto-PHP/mosquitto.c:457: error: ‘zend_fcall_info’ has no member named ‘object_ptr’
/src/Mosquitto-PHP/mosquitto.c:458: error: ‘zend_fcall_info’ has no member named ‘object_ptr’
/src/Mosquitto-PHP/mosquitto.c: In function ‘zim_Mosquitto_Client_onLog’:
/src/Mosquitto-PHP/mosquitto.c:489: error: incompatible type for argument 1 of ‘zval_addref_p’
/usr/php/include/php/Zend/zend_types.h:820: note: expected ‘struct zval *’ but argument is of type ‘zval’
/src/Mosquitto-PHP/mosquitto.c:491: error: ‘zend_fcall_info’ has no member named ‘object_ptr’
/src/Mosquitto-PHP/mosquitto.c:492: error: ‘zend_fcall_info’ has no member named ‘object_ptr’
/src/Mosquitto-PHP/mosquitto.c: In function ‘zim_Mosquitto_Client_onSubscribe’:
/src/Mosquitto-PHP/mosquitto.c:523: error: incompatible type for argument 1 of ‘zval_addref_p’
/usr/php/include/php/Zend/zend_types.h:820: note: expected ‘struct zval *’ but argument is of type ‘zval’
/src/Mosquitto-PHP/mosquitto.c:525: error: ‘zend_fcall_info’ has no member named ‘object_ptr’
/src/Mosquitto-PHP/mosquitto.c:526: error: ‘zend_fcall_info’ has no member named ‘object_ptr’
/src/Mosquitto-PHP/mosquitto.c: In function ‘zim_Mosquitto_Client_onUnsubscribe’:
/src/Mosquitto-PHP/mosquitto.c:557: error: incompatible type for argument 1 of ‘zval_addref_p’
/usr/php/include/php/Zend/zend_types.h:820: note: expected ‘struct zval *’ but argument is of type ‘zval’
/src/Mosquitto-PHP/mosquitto.c:559: error: ‘zend_fcall_info’ has no member named ‘object_ptr’
/src/Mosquitto-PHP/mosquitto.c:560: error: ‘zend_fcall_info’ has no member named ‘object_ptr’
/src/Mosquitto-PHP/mosquitto.c: In function ‘zim_Mosquitto_Client_onMessage’:
/src/Mosquitto-PHP/mosquitto.c:591: error: incompatible type for argument 1 of ‘zval_addref_p’
/usr/php/include/php/Zend/zend_types.h:820: note: expected ‘struct zval *’ but argument is of type ‘zval’
/src/Mosquitto-PHP/mosquitto.c:593: error: ‘zend_fcall_info’ has no member named ‘object_ptr’
/src/Mosquitto-PHP/mosquitto.c:594: error: ‘zend_fcall_info’ has no member named ‘object_ptr’
/src/Mosquitto-PHP/mosquitto.c: In function ‘zim_Mosquitto_Client_onPublish’:
/src/Mosquitto-PHP/mosquitto.c:625: error: incompatible type for argument 1 of ‘zval_addref_p’
/usr/php/include/php/Zend/zend_types.h:820: note: expected ‘struct zval *’ but argument is of type ‘zval’
/src/Mosquitto-PHP/mosquitto.c:627: error: ‘zend_fcall_info’ has no member named ‘object_ptr’
/src/Mosquitto-PHP/mosquitto.c:628: error: ‘zend_fcall_info’ has no member named ‘object_ptr’
/src/Mosquitto-PHP/mosquitto.c: In function ‘mosquitto_client_object_get’:
/src/Mosquitto-PHP/mosquitto.c:862: warning: initialization makes pointer from integer without a cast
/src/Mosquitto-PHP/mosquitto.c: In function ‘mosquitto_client_object_destroy’:
/src/Mosquitto-PHP/mosquitto.c:884: error: ‘zend_fcall_info’ has no member named ‘object_ptr’
/src/Mosquitto-PHP/mosquitto.c:884: error: ‘zend_fcall_info’ has no member named ‘object_ptr’
/src/Mosquitto-PHP/mosquitto.c:885: error: ‘zend_fcall_info’ has no member named ‘object_ptr’
/src/Mosquitto-PHP/mosquitto.c:885: error: ‘zend_fcall_info’ has no member named ‘object_ptr’
/src/Mosquitto-PHP/mosquitto.c:886: error: ‘zend_fcall_info’ has no member named ‘object_ptr’
/src/Mosquitto-PHP/mosquitto.c:886: error: ‘zend_fcall_info’ has no member named ‘object_ptr’
/src/Mosquitto-PHP/mosquitto.c:887: error: ‘zend_fcall_info’ has no member named ‘object_ptr’
/src/Mosquitto-PHP/mosquitto.c:887: error: ‘zend_fcall_info’ has no member named ‘object_ptr’
/src/Mosquitto-PHP/mosquitto.c:888: error: ‘zend_fcall_info’ has no member named ‘object_ptr’
/src/Mosquitto-PHP/mosquitto.c:888: error: ‘zend_fcall_info’ has no member named ‘object_ptr’
/src/Mosquitto-PHP/mosquitto.c:889: error: ‘zend_fcall_info’ has no member named ‘object_ptr’
/src/Mosquitto-PHP/mosquitto.c:889: error: ‘zend_fcall_info’ has no member named ‘object_ptr’
/src/Mosquitto-PHP/mosquitto.c:890: error: ‘zend_fcall_info’ has no member named ‘object_ptr’
/src/Mosquitto-PHP/mosquitto.c:890: error: ‘zend_fcall_info’ has no member named ‘object_ptr’
/src/Mosquitto-PHP/mosquitto.c: At top level:
/src/Mosquitto-PHP/mosquitto.c:900: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘mosquitto_client_object_new’
/src/Mosquitto-PHP/mosquitto.c:967:56: error: macro "ZVAL_STRINGL" passed 4 arguments, but takes just 3
/src/Mosquitto-PHP/mosquitto.c: In function ‘php_mosquitto_connect_callback’:
/src/Mosquitto-PHP/mosquitto.c:967: error: ‘ZVAL_STRINGL’ undeclared (first use in this function)
/src/Mosquitto-PHP/mosquitto.c:967: error: (Each undeclared identifier is reported only once
/src/Mosquitto-PHP/mosquitto.c:967: error: for each function it appears in.)
/src/Mosquitto-PHP/mosquitto.c:970: warning: assignment from incompatible pointer type
/src/Mosquitto-PHP/mosquitto.c:972: error: ‘zend_fcall_info’ has no member named ‘retval_ptr_ptr’
/src/Mosquitto-PHP/mosquitto.c:976: error: invalid type argument of ‘unary *’ (have ‘zval’)
/src/Mosquitto-PHP/mosquitto.c:980: warning: passing argument 1 of ‘zval_ptr_dtor’ from incompatible pointer type
/usr/php/include/php/Zend/zend_variables.h:112: note: expected ‘struct zval *’ but argument is of type ‘struct zval *

/src/Mosquitto-PHP/mosquitto.c:981: warning: passing argument 1 of ‘_zval_ptr_dtor’ from incompatible pointer type
/usr/php/include/php/Zend/zend_variables.h:112: note: expected ‘struct zval ’ but argument is of type ‘struct zval *
/src/Mosquitto-PHP/mosquitto.c:984: warning: passing argument 1 of ‘_zval_ptr_dtor’ from incompatible pointer type
/usr/php/include/php/Zend/zend_variables.h:112: note: expected ‘struct zval ’ but argument is of type ‘struct zval *
/src/Mosquitto-PHP/mosquitto.c: In function ‘php_mosquitto_disconnect_callback’:
/src/Mosquitto-PHP/mosquitto.c:1005: warning: assignment from incompatible pointer type
/src/Mosquitto-PHP/mosquitto.c:1007: error: ‘zend_fcall_info’ has no member named ‘retval_ptr_ptr’
/src/Mosquitto-PHP/mosquitto.c:1011: error: invalid type argument of ‘unary _’ (have ‘zval’)
/src/Mosquitto-PHP/mosquitto.c:1015: warning: passing argument 1 of ‘zval_ptr_dtor’ from incompatible pointer type
/usr/php/include/php/Zend/zend_variables.h:112: note: expected ‘struct zval *’ but argument is of type ‘struct zval *

/src/Mosquitto-PHP/mosquitto.c:1018: warning: passing argument 1 of ‘_zval_ptr_dtor’ from incompatible pointer type
/usr/php/include/php/Zend/zend_variables.h:112: note: expected ‘struct zval ’ but argument is of type ‘struct zval *
/src/Mosquitto-PHP/mosquitto.c:1039:44: error: macro "ZVAL_STRINGL" passed 4 arguments, but takes just 3
/src/Mosquitto-PHP/mosquitto.c: In function ‘php_mosquitto_log_callback’:
/src/Mosquitto-PHP/mosquitto.c:1039: error: ‘ZVAL_STRINGL’ undeclared (first use in this function)
/src/Mosquitto-PHP/mosquitto.c:1044: warning: assignment from incompatible pointer type
/src/Mosquitto-PHP/mosquitto.c:1046: error: ‘zend_fcall_info’ has no member named ‘retval_ptr_ptr’
/src/Mosquitto-PHP/mosquitto.c:1050: error: invalid type argument of ‘unary _’ (have ‘zval’)
/src/Mosquitto-PHP/mosquitto.c:1054: warning: passing argument 1 of ‘zval_ptr_dtor’ from incompatible pointer type
/usr/php/include/php/Zend/zend_variables.h:112: note: expected ‘struct zval *’ but argument is of type ‘struct zval *

/src/Mosquitto-PHP/mosquitto.c:1055: warning: passing argument 1 of ‘_zval_ptr_dtor’ from incompatible pointer type
/usr/php/include/php/Zend/zend_variables.h:112: note: expected ‘struct zval ’ but argument is of type ‘struct zval *
/src/Mosquitto-PHP/mosquitto.c:1058: warning: passing argument 1 of ‘_zval_ptr_dtor’ from incompatible pointer type
/usr/php/include/php/Zend/zend_variables.h:112: note: expected ‘struct zval ’ but argument is of type ‘struct zval *
/src/Mosquitto-PHP/mosquitto.c: In function ‘php_mosquitto_message_callback’:
/src/Mosquitto-PHP/mosquitto.c:1078: warning: cast to pointer from integer of different size
/src/Mosquitto-PHP/mosquitto.c:1082: warning: assignment from incompatible pointer type
/src/Mosquitto-PHP/mosquitto.c:1084: error: ‘zend_fcall_info’ has no member named ‘retval_ptr_ptr’
/src/Mosquitto-PHP/mosquitto.c:1088: error: invalid type argument of ‘unary _’ (have ‘zval’)
/src/Mosquitto-PHP/mosquitto.c:1092: warning: passing argument 1 of ‘zval_ptr_dtor’ from incompatible pointer type
/usr/php/include/php/Zend/zend_variables.h:112: note: expected ‘struct zval *’ but argument is of type ‘struct zval *

/src/Mosquitto-PHP/mosquitto.c:1095: warning: passing argument 1 of ‘_zval_ptr_dtor’ from incompatible pointer type
/usr/php/include/php/Zend/zend_variables.h:112: note: expected ‘struct zval ’ but argument is of type ‘struct zval *
/src/Mosquitto-PHP/mosquitto.c: In function ‘php_mosquitto_publish_callback’:
/src/Mosquitto-PHP/mosquitto.c:1118: warning: assignment from incompatible pointer type
/src/Mosquitto-PHP/mosquitto.c:1120: error: ‘zend_fcall_info’ has no member named ‘retval_ptr_ptr’
/src/Mosquitto-PHP/mosquitto.c:1124: error: invalid type argument of ‘unary _’ (have ‘zval’)
/src/Mosquitto-PHP/mosquitto.c:1128: warning: passing argument 1 of ‘zval_ptr_dtor’ from incompatible pointer type
/usr/php/include/php/Zend/zend_variables.h:112: note: expected ‘struct zval *’ but argument is of type ‘struct zval *

/src/Mosquitto-PHP/mosquitto.c:1131: warning: passing argument 1 of ‘_zval_ptr_dtor’ from incompatible pointer type
/usr/php/include/php/Zend/zend_variables.h:112: note: expected ‘struct zval ’ but argument is of type ‘struct zval *
/src/Mosquitto-PHP/mosquitto.c: In function ‘php_mosquitto_subscribe_callback’:
/src/Mosquitto-PHP/mosquitto.c:1161: warning: assignment from incompatible pointer type
/src/Mosquitto-PHP/mosquitto.c:1163: error: ‘zend_fcall_info’ has no member named ‘retval_ptr_ptr’
/src/Mosquitto-PHP/mosquitto.c:1167: error: invalid type argument of ‘unary _’ (have ‘zval’)
/src/Mosquitto-PHP/mosquitto.c:1171: warning: passing argument 1 of ‘zval_ptr_dtor’ from incompatible pointer type
/usr/php/include/php/Zend/zend_variables.h:112: note: expected ‘struct zval *’ but argument is of type ‘struct zval *

/src/Mosquitto-PHP/mosquitto.c:1172: warning: passing argument 1 of ‘_zval_ptr_dtor’ from incompatible pointer type
/usr/php/include/php/Zend/zend_variables.h:112: note: expected ‘struct zval ’ but argument is of type ‘struct zval *
/src/Mosquitto-PHP/mosquitto.c:1173: warning: passing argument 1 of ‘_zval_ptr_dtor’ from incompatible pointer type
/usr/php/include/php/Zend/zend_variables.h:112: note: expected ‘struct zval ’ but argument is of type ‘struct zval *
/src/Mosquitto-PHP/mosquitto.c:1176: warning: passing argument 1 of ‘_zval_ptr_dtor’ from incompatible pointer type
/usr/php/include/php/Zend/zend_variables.h:112: note: expected ‘struct zval ’ but argument is of type ‘struct zval *
/src/Mosquitto-PHP/mosquitto.c: In function ‘php_mosquitto_unsubscribe_callback’:
/src/Mosquitto-PHP/mosquitto.c:1198: warning: assignment from incompatible pointer type
/src/Mosquitto-PHP/mosquitto.c:1200: error: ‘zend_fcall_info’ has no member named ‘retval_ptr_ptr’
/src/Mosquitto-PHP/mosquitto.c:1204: error: invalid type argument of ‘unary _’ (have ‘zval’)
/src/Mosquitto-PHP/mosquitto.c:1208: warning: passing argument 1 of ‘zval_ptr_dtor’ from incompatible pointer type
/usr/php/include/php/Zend/zend_variables.h:112: note: expected ‘struct zval *’ but argument is of type ‘struct zval *

/src/Mosquitto-PHP/mosquitto.c:1211: warning: passing argument 1 of ‘_zval_ptr_dtor’ from incompatible pointer type
/usr/php/include/php/Zend/zend_variables.h:112: note: expected ‘struct zval ’ but argument is of type ‘struct zval *
/src/Mosquitto-PHP/mosquitto.c: In function ‘zm_startup_mosquitto’:
/src/Mosquitto-PHP/mosquitto.c:1302: error: too many arguments to function ‘zend_register_internal_class_ex’
/src/Mosquitto-PHP/mosquitto.c:1303: error: ‘mosquitto_client_object_new’ undeclared (first use in this function)
/src/Mosquitto-PHP/mosquitto.c:1307: error: too many arguments to function ‘zend_register_internal_class_ex’
make: *** [mosquitto.lo] Error 1

Option to set the version of the MQTT protocol

When using mosquitto_pub (1.4.8) on the command line, there is an option to set the protocol version

-V : specify the version of the MQTT protocol to use when connecting.
Can be mqttv31 or mqttv311. Defaults to mqttv31.

I suppose Mosquitto-PHP makes use of the default protocol version and there is no way to set the version in the client code? Unfortunately my broker (Home Assistant built-in broker) requires mqttv311 :(

Will now try to set up my own custom broker using Mosquitto and integrate it into my Home Assistant setup, but it would be nice to be able to set the version in my client script.

EDIT: It's working now, but please consider introducing the protocol option anyway …

Memory garbage collection

I do stress test below:

  • PHP Client subsriber a topic
  • Use MQTT fx ( I use Mac) with script to Publish message continuously (500ms/message)
    So PHP Client's memory increases gradually, although I don't do anything in callback.
    Is this PHP Client's problem or PHP garbage collection (I use PHP 5.5) ?

Is it normal when i publish some messages like this?

mytest.php:
$client = new Mosquitto\Client();
$client->connect("x.x.x.x", 1883, 60);

while ($client->loop() == 0) {
$message = "Test message at " . date("Y-m-d H:i:s");
$client->publish('mytopic', $message, 0, false);
$client->loop();
sleep(1);
}

When i first use browser open mytest.php ,the subscribe side receive the message sucessfully,but i close the page,the subscribe side still can receive the message ,what's going wrong?

PHP mosquitto.so

Hello,
I'm trying to install Mosquitto on a CentOS7 server. It is the first time on this operating system, I usually use Ubuntu, and I always installed Mosquitto.
I've installed Mosquitto using pecl as usual and everithing seemed fine, now when I launch a php script from cli and also with browser I get this error and Mosquitto doesn't work

PHP Warning: PHP Startup: Unable to load dynamic library '/opt/plesk/php/5.6/lib64/php/modules/mosquitto.so' - /opt/plesk/php/5.6/lib64/php/modules/mosquitto.so: cannot open shared object file: No such file or directory in Unknown on line 0

How can i solve?
Thank you!

php7.1 make error

make
/bin/bash /home/lio/mqtt/php/Mosquitto-PHP/libtool --mode=compile cc  -I. -I/home/lio/mqtt/php/Mosquitto-PHP -DPHP_ATOM_INC -I/home/lio/mqtt/php/Mosquitto-PHP/include -I/home/lio/mqtt/php/Mosquitto-PHP/main -I/home/lio/mqtt/php/Mosquitto-PHP -I/usr/include/php/20160303-I/usr/include/php/20160303/main -I/usr/include/php/20160303/TSRM -I/usr/include/php/20160303/Zend -I/usr/include/php/20160303/ext -I/usr/include/php/20160303/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c -o mosquitto.lo
libtool: compile:  cc -I. -I/home/lio/mqtt/php/Mosquitto-PHP -DPHP_ATOM_INC -I/home/lio/mqtt/php/Mosquitto-PHP/include -I/home/lio/mqtt/php/Mosquitto-PHP/main -I/home/lio/mqtt/php/Mosquitto-PHP -I/usr/include/php/20160303 -I/usr/include/php/20160303/main -I/usr/include/php/20160303/TSRM -I/usr/include/php/20160303/Zend -I/usr/include/php/20160303/ext -I/usr/include/php/20160303/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c  -fPIC -DPIC -o .libs/mosquitto.o
/home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c: In function 'zim_Mosquitto_Client___construct':
/home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c:163:2: warning: passing argument 2 of 'mosquitto_new' makes pointer from integer without a cast [enabled by default]
  object->client = mosquitto_new(id, clean_session, object);
  ^
In file included from /home/lio/mqtt/php/Mosquitto-PHP/php_mosquitto.h:37:0,
                 from /home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c:12:
/usr/include/mosquitto.h:196:34: note: expected 'void *' but argument is of type 'zend_bool'
 libmosq_EXPORT struct mosquitto *mosquitto_new(const char *id, void *obj);
                                  ^
/home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c:163:2: error: too many arguments to function 'mosquitto_new'
  object->client = mosquitto_new(id, clean_session, object);
  ^
In file included from /home/lio/mqtt/php/Mosquitto-PHP/php_mosquitto.h:37:0,
                 from /home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c:12:
/usr/include/mosquitto.h:196:34: note: declared here
 libmosq_EXPORT struct mosquitto *mosquitto_new(const char *id, void *obj);
                                  ^
/home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c: In function 'zim_Mosquitto_Client_setWill':
/home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c:333:2: warning: passing argument 3 of 'mosquitto_will_set' makes pointer from integer without a cast [enabled by default]
  retval = mosquitto_will_set(object->client, topic, payload_len, (void *) payload, qos, retain);
  ^
In file included from /home/lio/mqtt/php/Mosquitto-PHP/php_mosquitto.h:37:0,
                 from /home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c:12:
/usr/include/mosquitto.h:268:20: note: expected 'const char *' but argument is of type 'mosquitto_strlen_type'
 libmosq_EXPORT int mosquitto_will_set(struct mosquitto *mosq, bool will, const char *topic, uint32_t payloadlen, const uint8_t *payload, int qos, bool retain);
                    ^
/home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c:333:2: warning: passing argument 4 of 'mosquitto_will_set' makes integer from pointer without a cast [enabled by default]
  retval = mosquitto_will_set(object->client, topic, payload_len, (void *) payload, qos, retain);
  ^
In file included from /home/lio/mqtt/php/Mosquitto-PHP/php_mosquitto.h:37:0,
                 from /home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c:12:
/usr/include/mosquitto.h:268:20: note: expected 'uint32_t' but argument is of type 'void *'
 libmosq_EXPORT int mosquitto_will_set(struct mosquitto *mosq, bool will, const char *topic, uint32_t payloadlen, const uint8_t *payload, int qos, bool retain);
                    ^
/home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c:333:2: warning: passing argument 5 of 'mosquitto_will_set' makes pointer from integer without a cast [enabled by default]
  retval = mosquitto_will_set(object->client, topic, payload_len, (void *) payload, qos, retain);
  ^
In file included from /home/lio/mqtt/php/Mosquitto-PHP/php_mosquitto.h:37:0,
                 from /home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c:12:
/usr/include/mosquitto.h:268:20: note: expected 'const uint8_t *' but argument is of type 'zend_long'
 libmosq_EXPORT int mosquitto_will_set(struct mosquitto *mosq, bool will, const char *topic, uint32_t payloadlen, const uint8_t *payload, int qos, bool retain);
                    ^
/home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c:333:2: error: too few arguments to function 'mosquitto_will_set'
  retval = mosquitto_will_set(object->client, topic, payload_len, (void *) payload, qos, retain);
  ^
In file included from /home/lio/mqtt/php/Mosquitto-PHP/php_mosquitto.h:37:0,
                 from /home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c:12:
/usr/include/mosquitto.h:268:20: note: declared here
 libmosq_EXPORT int mosquitto_will_set(struct mosquitto *mosq, bool will, const char *topic, uint32_t payloadlen, const uint8_t *payload, int qos, bool retain);
                    ^
/home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c: In function 'zim_Mosquitto_Client_connect':
/home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c:401:3: error: too few arguments to function 'mosquitto_connect'
   retval = mosquitto_connect(object->client, host, port, keepalive);
   ^
In file included from /home/lio/mqtt/php/Mosquitto-PHP/php_mosquitto.h:37:0,
                 from /home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c:12:
/usr/include/mosquitto.h:322:20: note: declared here
 libmosq_EXPORT int mosquitto_connect(struct mosquitto *mosq, const char *host, int port, int keepalive, bool clean_session);
                    ^
/home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c: In function 'zim_Mosquitto_Client_onConnect':
/home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c:456:2: warning: passing argument 2 of 'mosquitto_connect_callback_set' from incompatible pointer type [enabled by default]
  mosquitto_connect_callback_set(object->client, php_mosquitto_connect_callback);
  ^
In file included from /home/lio/mqtt/php/Mosquitto-PHP/php_mosquitto.h:37:0,
                 from /home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c:12:
/usr/include/mosquitto.h:618:21: note: expected 'void (*)(void *, int)' but argument is of type 'void (*)(struct mosquitto *, void *, int)'
 libmosq_EXPORT void mosquitto_connect_callback_set(struct mosquitto *mosq, void (*on_connect)(void *, int));
                     ^
/home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c: In function 'zim_Mosquitto_Client_onDisconnect':
/home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c:485:2: warning: passing argument 2 of 'mosquitto_disconnect_callback_set' from incompatible pointer type [enabled by default]
  mosquitto_disconnect_callback_set(object->client, php_mosquitto_disconnect_callback);
  ^
In file included from /home/lio/mqtt/php/Mosquitto-PHP/php_mosquitto.h:37:0,
                 from /home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c:12:
/usr/include/mosquitto.h:634:21: note: expected 'void (*)(void *)' but argument is of type 'void (*)(struct mosquitto *, void *, int)'
 libmosq_EXPORT void mosquitto_disconnect_callback_set(struct mosquitto *mosq, void (*on_disconnect)(void *));
                     ^
/home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c: In function 'zim_Mosquitto_Client_onSubscribe':
/home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c:543:2: warning: passing argument 2 of 'mosquitto_subscribe_callback_set' from incompatible pointer type [enabled by default]
  mosquitto_subscribe_callback_set(object->client, php_mosquitto_subscribe_callback);
  ^
In file included from /home/lio/mqtt/php/Mosquitto-PHP/php_mosquitto.h:37:0,
                 from /home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c:12:
/usr/include/mosquitto.h:693:21: note: expected 'void (*)(void *, uint16_t,  int,  const uint8_t *)' but argument is of type 'void (*)(struct mosquitto *, void *, int,  int,  const int *)'
 libmosq_EXPORT void mosquitto_subscribe_callback_set(struct mosquitto *mosq, void (*on_subscribe)(void *, uint16_t, int, const uint8_t *));
                     ^
/home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c: In function 'zim_Mosquitto_Client_onUnsubscribe':
/home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c:572:2: warning: passing argument 2 of 'mosquitto_unsubscribe_callback_set' from incompatible pointer type [enabled by default]
  mosquitto_unsubscribe_callback_set(object->client, php_mosquitto_unsubscribe_callback);
  ^
In file included from /home/lio/mqtt/php/Mosquitto-PHP/php_mosquitto.h:37:0,
                 from /home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c:12:
/usr/include/mosquitto.h:710:21: note: expected 'void (*)(void *, uint16_t)' but argument is of type 'void (*)(struct mosquitto *, void *, int)'
 libmosq_EXPORT void mosquitto_unsubscribe_callback_set(struct mosquitto *mosq, void (*on_unsubscribe)(void *, uint16_t));
                     ^
/home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c: In function 'zim_Mosquitto_Client_onMessage':
/home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c:601:2: warning: passing argument 2 of 'mosquitto_message_callback_set' from incompatible pointer type [enabled by default]
  mosquitto_message_callback_set(object->client, php_mosquitto_message_callback);
  ^
In file included from /home/lio/mqtt/php/Mosquitto-PHP/php_mosquitto.h:37:0,
                 from /home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c:12:
/usr/include/mosquitto.h:673:21: note: expected 'void (*)(void *, const struct mosquitto_message *)' but argument is of type 'void (*)(struct mosquitto *, void *, const struct mosquitto_message *)'
 libmosq_EXPORT void mosquitto_message_callback_set(struct mosquitto *mosq, void (*on_message)(void *, const struct mosquitto_message *));
                     ^
/home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c: In function 'zim_Mosquitto_Client_onPublish':
/home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c:630:2: warning: passing argument 2 of 'mosquitto_publish_callback_set' from incompatible pointer type [enabled by default]
  mosquitto_publish_callback_set(object->client, php_mosquitto_publish_callback);
  ^
In file included from /home/lio/mqtt/php/Mosquitto-PHP/php_mosquitto.h:37:0,
                 from /home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c:12:
/usr/include/mosquitto.h:651:21: note: expected 'void (*)(void *, uint16_t)' but argument is of type 'void (*)(struct mosquitto *, void *, int)'
 libmosq_EXPORT void mosquitto_publish_callback_set(struct mosquitto *mosq, void (*on_publish)(void *, uint16_t));
                     ^
/home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c: In function 'zim_Mosquitto_Client_publish':
/home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c:705:2: warning: passing argument 2 of 'mosquitto_publish' from incompatible pointer type [enabled by default]
  retval = mosquitto_publish(object->client, &mid, topic, payload_len, (void *) payload, qos, retain);
  ^
In file included from /home/lio/mqtt/php/Mosquitto-PHP/php_mosquitto.h:37:0,
                 from /home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c:12:
/usr/include/mosquitto.h:395:20: note: expected 'uint16_t *' but argument is of type 'int *'
 libmosq_EXPORT int mosquitto_publish(struct mosquitto *mosq, uint16_t *mid, const char *topic, uint32_t payloadlen, const uint8_t *payload, int qos, bool retain);
                    ^
/home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c: In function 'zim_Mosquitto_Client_subscribe':
/home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c:730:2: warning: passing argument 2 of 'mosquitto_subscribe' from incompatible pointer type [enabled by default]
  retval = mosquitto_subscribe(object->client, &mid, sub, qos);
  ^
In file included from /home/lio/mqtt/php/Mosquitto-PHP/php_mosquitto.h:37:0,
                 from /home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c:12:
/usr/include/mosquitto.h:417:20: note: expected 'uint16_t *' but argument is of type 'int *'
 libmosq_EXPORT int mosquitto_subscribe(struct mosquitto *mosq, uint16_t *mid, const char *sub, int qos);
                    ^
/home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c: In function 'zim_Mosquitto_Client_unsubscribe':
/home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c:754:2: warning: passing argument 2 of 'mosquitto_unsubscribe' from incompatible pointer type [enabled by default]
  retval = mosquitto_unsubscribe(object->client, &mid, sub);
  ^
In file included from /home/lio/mqtt/php/Mosquitto-PHP/php_mosquitto.h:37:0,
                 from /home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c:12:
/usr/include/mosquitto.h:438:20: note: expected 'uint16_t *' but argument is of type 'int *'
 libmosq_EXPORT int mosquitto_unsubscribe(struct mosquitto *mosq, uint16_t *mid, const char *sub);
                    ^
/home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c: In function 'zim_Mosquitto_Client_loop':
/home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c:777:2: error: too many arguments to function 'mosquitto_loop'
  retval = mosquitto_loop(object->client, timeout, max_packets);
  ^
In file included from /home/lio/mqtt/php/Mosquitto-PHP/php_mosquitto.h:37:0,
                 from /home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c:12:
/usr/include/mosquitto.h:503:20: note: declared here
 libmosq_EXPORT int mosquitto_loop(struct mosquitto *mosq, int timeout);
                    ^
/home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c: In function 'zim_Mosquitto_Client_loopForever':
/home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c:800:3: error: too many arguments to function 'mosquitto_loop'
   retval = mosquitto_loop(object->client, timeout, max_packets);
   ^
In file included from /home/lio/mqtt/php/Mosquitto-PHP/php_mosquitto.h:37:0,
                 from /home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c:12:
/usr/include/mosquitto.h:503:20: note: declared here
 libmosq_EXPORT int mosquitto_loop(struct mosquitto *mosq, int timeout);
                    ^
/home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c: In function 'mosquitto_client_object_destroy':
/home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c:858:2: error: too many arguments to function 'mosquitto_loop'
  mosquitto_loop(client->client, 100, 1);
  ^
In file included from /home/lio/mqtt/php/Mosquitto-PHP/php_mosquitto.h:37:0,
                 from /home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c:12:
/usr/include/mosquitto.h:503:20: note: declared here
 libmosq_EXPORT int mosquitto_loop(struct mosquitto *mosq, int timeout);
                    ^
/home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c: In function 'php_mosquitto_handle_errno':
/home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c:939:25: warning: initialization makes pointer from integer without a cast [enabled by default]
   const char *message = mosquitto_strerror(retval);
                         ^
/home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c: In function 'php_mosquitto_connect_callback':
/home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c:964:10: warning: assignment makes pointer from integer without a cast [enabled by default]
  message = mosquitto_connack_string(rc);
          ^
/home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c: In function 'php_mosquitto_strerror_wrapper':
/home/lio/mqtt/php/Mosquitto-PHP/mosquitto.c:838:12: warning: ignoring return value of 'strerror_r', declared with attribute warn_unused_result [-Wunused-result]
  strerror_r(err, buf, 256);
            ^
make: *** [mosquitto.lo] Error 1

How to use getSocket return value in PHP?

I would like to use Mosquitto-PHP together with React-PHP.
React-PHP uses stream_select to detect if a socket is ready for something.
The socket parameter used in stream_select and socket_select are resources, but the Mosquitto-PHP getSocket function returns a long integer.

I have never written any extension code my self, but tried to look at the code for stream and sockets, to see if I could change the unix socket to a PHP resource before returning from getSocket. But they seem to use two different resources.
Does anybody know how to convert a unix socket (integer) to a PHP resource?

lost message when publish to server with setCredentials

$client = new Mosquitto\Client();
$client->setCredentials('username', 'password');
$client->connect();
$client->publish('test', '1');
$client->loop();
$client->publish('test', '2');
$client->loop();
$client->publish('test', '3');
$client->loop();
$client->disconnect();

Result: sometime i received 2 or 3 msg, but almost the first msg only.

Can't know next step to make Mosquitto-PHP works

I just installed Mosquitto 1.3.4.1 on Mac OS X with:

  • brew install mosquito

Tried in my terminal to test it with :

  • mosquitto_sub -h 127.0.0.1 -t "test"
    and
  • mosquitto_pub -h 127.0.0.1 -t "test" -m "hey"

Working too.

Now I would like to use it with PHP, more precisely to publish from PHP. I tried to install your Mosquitto-PHP with :

  • pecl install Mosquitto-alpha

It didn't work from the first try because I had a "can't execute 'make'" so I had to do that :

No errors so I suppose that's installed. I added extension=mosquitto.so to my php.ini, the one that's referred in Loaded Configuration File (=/usr/local/php5/lib/php.ini). But when I try the exemple code, I've this error :

  • Fatal error: Class 'Mosquitto\Client' not found in (...)

Do someone know which step I missed ?

Best regards.

Daniel Costa

Unable to load mosquitto.so undefined symbol: executor_globals in Unknown on line 0

Dear all,
I am using CentOS 7, Apache 2.4, PHP 5.6, and install Mosquitto-PHP via pecl command and config php.ini to load mosquitto library, then I run php command, I got below message:

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/mosquitto.so' - /usr/lib64/php/modules/mosquitto.so: undefined symbol: executor_globals in Unknown on line 0

I am use absolute path to include mosquitto library, I can't find any message about this warning.
Do anyone have same issue? How to resolve it?

Thanks.

mid is alwais 0 ?

Message received on (AD557EBD/92) : [140NkFA041|*E]

object(Mosquitto\Message)#5 (5) {
["mid"]=>
int(0)
["topic"]=>
string(11) "AD557EBD/92"
["payload"]=>
string(13) "140NkFA041|*E"
["qos"]=>
int(0)
["retain"]=>
bool(false)
}

Message received on (AD557EBD/92) : [140Q=2D040|*E]

object(Mosquitto\Message)#5 (5) {
["mid"]=>
int(0)
["topic"]=>
string(11) "AD557EBD/92"
["payload"]=>
string(13) "140Q=2D040|*E"
["qos"]=>
int(0)
["retain"]=>
bool(false)
}

Error handle message PHP7.0

Hi, today i install this library for replace the old bluerhinos/phpMQTT for PHP7.0, but when i try get the message the request go down.

PD: i can publish without problems

Segmentation fault

I am trying to test Mosquitto with TLS but I get a segmentation fault error.

This is the code:

define('BROKER', '10.11.25.36');
define('PORT', 8883);
define('SECURE', TRUE);

$client = new Mosquitto\Client();
$client->onConnect('connect');
$client->onDisconnect('disconnect');
$client->onSubscribe('subscribe');
$client->onMessage('message');

if(SECURE){
$client->setTlsOptions($certReqs = Mosquitto\Client::SSL_VERIFY_PEER, $tlsVersion = 'tlsv1.2', $cipers=NULL);
$client->setTlsCertificates($caPath = 'path/to/my/ca.crt');
}

try {
$client->connect(BROKER, PORT, 60);
$client->onLog('logger');
$client->subscribe('/api/send/#', 1);
$client->loopForever();
}
catch (Exception $e){
echo "ERROR " . $e->getMessage();
}

What am I missing?

Install Problem

Hello , i have a ubuntu server.

i installed mosquitto from mosquitto.org

and i tried to install your package like

pecl install Mosquitto-alpha

but i had this error :

root@www:~# pecl install Mosquitto-alpha
downloading Mosquitto-0.3.0.tgz ...
Starting to download Mosquitto-0.3.0.tgz (25,395 bytes)
.........done: 25,395 bytes
5 source files, building
running: phpize
Configuring for:
PHP Api Version: 20121113
Zend Module Api No: 20121212
Zend Extension Api No: 220121212
Please provide the prefix of the libmosquitto installation [autodetect] :
building in /tmp/pear/temp/pear-build-rootghpRkX/Mosquitto-0.3.0
running: /tmp/pear/temp/Mosquitto/configure --with-mosquitto
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib
checking for PHP extension directory... /usr/lib/php5/20121212
checking for PHP installed headers prefix... /usr/include/php5
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... re2c
checking for re2c version... 0.13.5 (ok)
checking for gawk... gawk
checking for mosquitto support... yes, shared
checking for mosquitto files in default path... not found
configure: error: Please reinstall the mosquitto distribution
ERROR: `/tmp/pear/temp/Mosquitto/configure --with-mosquitto' failed

disconnect response code 7

Hi

I got a problem about code = 7.

I use $client->loopForever(3600);
But mqtt still disconnect and the response code is 7

What is the meaning about 7 of broker?

Thank you

PHP 7.0.10 1 SAPI run memory leaks detected

sh$ php mqtt.php
[Thu Sep 22 14:15:03 2016] Script: 'mqtt.php'
/usr/local/src/php-7.0.10/Zend/zend_closures.c(367) : Freeing 0x7FC08DC78000 (296 bytes), script=mqtt.php
=== Total 1 memory leaks detected ===

`

onConnect(function() use ($c) { $c->publish('mgdm/test', 'Hello', 2); }); $c->connect('test.mosquitto.org'); for ($i = 0; $i < 100; $i++) { // Loop around to permit the library to do its work $c->loop(1); } echo "Finished\n"; `

loop/loopFoever throw empty exception randomly

I am writing a client to save all chat to MySQL, but loop/loopForever not working correctly.
CODE:
$c = new Mosquitto\Client('saveAllChat',1); $c->onConnect(function() use ($c) { $c->subscribe('#', 1); }); $c->onMessage(function($m) { // var_dump($m); }); $c->connect('127.0.0.1'); for ($i = 0; $i < 1000; $i++) { echo $i.' '; $c->loop(1); //the loop throw excption randomly, sometimes $i = 10, sometimes $i = 543 }
ERROR:
`PHP Fatal error: Uncaught exception 'Mosquitto\Exception' in /home/cj/www/dev/mqtt/onMeesage.php:18
Stack trace:
#0 /home/cj/www/dev/mqtt/onMeesage.php(18): Mosquitto\Client->loop(1)
#1 {main}
thrown in /home/cj/www/dev/mqtt/onMeesage.php on line 18

Server environment:
Ubuntu 14.04 LTS
libmosquitto-dev installed from ppa:mosquitto-dev/mosquitto-ppa
the extention was intalled by 'pecl install Mosquitto-alpha'

anyone have any idea?

Installing Mosquitto server on Redhat Linux ..

Can somebody help me in installing Mosquitto server on Redhat Linux . Greatly appreciated and thanks in advance if some body can post the steps to install Mosquitto server on Redhat Linux.

About setTlsCertificates

please help me how to solve the problem.

function push_msg($target, $message) {
try {
$client = new Mosquitto\Client();
$client->setTlsCertificates('/etc/mosquitto/client/ca.crt', '/etc/mosquitto/client/client.crt', '/etc/mosquitto/client/client.key');
$client->onConnect(function() use ($client) {
echo "Connected successfully\n";
$client->disconnect();
});
$client->connect('192.168.1.168', 1883);
$client->loopForever();
unset($client);
} catch (Mosquitto\Exception $ex) {
var_dump($ex->getMessage());
}
}

execute function -> push_msg('test', date('Y-m-d H:i:s'));
catch Exception "A TLS error occurred."

mosquitto error msg.
1504840227: New connection from 192.168.1.168 on port 1883.
1504840227: OpenSSL Error: error:14094416:SSL routines:SSL3_READ_BYTES:sslv3 alert certificate unknown
1504840227: OpenSSL Error: error:140940E5:SSL routines:SSL3_READ_BYTES:ssl handshake failure
1504840227: Socket error on client , disconnecting.

But.
The following instructions can be used.
mosquitto_sub -t test --cafile /etc/mosquitto/client/ca.crt --cert /etc/mosquitto/client/client.crt --key /etc/mosquitto/client/client.key --insecure

Cannot Use class files with my existing project

I have done with all installation prerequisites. I have now currently loadedmosquitto.so extension in my php.ini. But, I can use:
$client = new \Mosquitto\Client();
But cant:
$base = new \EventBase();
Is there anything, I have to do to remove fatal error of

Class 'EventBase' not found.

Any help will be appreciated.
extension

I have executed in cli mode.

a problem on publish with http request

when i do stress test with mine website, i use a iteration as follow to publish message:

/**
 * @file web-pub.php
 */

$client = new Mosquitto\Client(uniqid());
$client->connect('server.mosquitto', 1883, 60);
for($i = 0; $i < 1000; $i++) {
    $client->publish('/test/stress', 'message stress test '.$i);
}

and then I use http_load to send 100 request to the server, If working properly, i will receive 100000 messages in test client, but, in actually, I only can receive about 70000 messages, about 30k messages is lost.

i guess the method Mosquitto\Client::publish created a thread to send message to the broker, and if the message inflight queue is long enough, the PHP process finished processing the request and then exit without waiting for the socket thread finishing work.

this will cause message lose in high concurrent server!

How to break a loop

Hi!

Firtstly, thanks for this plugin!

Secondly, I have the plugin working fine with PHP 7 and Ubuntu 10.6

I would like to know how to break this loop after get the first payload:

for ($i = 0; $i < 50; $i++) {
	$client->loop(100);
} 

Sorry for this basic question I'm a newbie.

Best regards.

PHP Static Analysis errors

I got this error when running PHP Static Analysis Tool (phpstan)

Method Mosquitto\Client::connect() invoked with 3 parameters, 4
Method Mosquitto\Client::loop() invoked with 0 parameters, 2 required.
Access to an undefined property Mosquitto\Message::$topic
...

It possible to replace ZEND_BEGIN_ARG_INFO by ZEND_BEGIN_ARG_INFO_EX ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.