diff options
-rw-r--r-- | php-pecl-stomp.spec | 46 | ||||
-rw-r--r-- | stomp-php8.patch | 1639 |
2 files changed, 1665 insertions, 20 deletions
diff --git a/php-pecl-stomp.spec b/php-pecl-stomp.spec index 2fc9a84..5f16bb2 100644 --- a/php-pecl-stomp.spec +++ b/php-pecl-stomp.spec @@ -1,6 +1,6 @@ # remimrepo/fedora spec file for php-pecl-stomp # -# Copyright (c) 2014-2019 Remi Collet +# Copyright (c) 2014-2021 Remi Collet # License: CC-BY-SA # http://creativecommons.org/licenses/by-sa/4.0/ # @@ -16,12 +16,15 @@ Summary: Stomp client extension Name: %{?scl_prefix}php-pecl-%{pecl_name} Version: 2.0.2 -Release: 5%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} +Release: 6%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} License: PHP -URL: http://pecl.php.net/package/%{pecl_name} -Source0: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz +URL: https://pecl.php.net/package/%{pecl_name} +Source0: https://pecl.php.net/get/%{pecl_name}-%{version}.tgz + +Patch0: %{pecl_name}-php8.patch BuildRequires: %{?dtsprefix}gcc +BuildRequires: make BuildRequires: %{?scl_prefix}php-devel > 7 BuildRequires: %{?scl_prefix}php-pear BuildRequires: openssl-devel @@ -39,30 +42,20 @@ Provides: %{?scl_prefix}php-pecl-%{pecl_name} = %{version}-%{rele Provides: %{?scl_prefix}php-pecl-%{pecl_name}%{?_isa} = %{version}-%{release} %endif -%if "%{?vendor}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel} +%if "%{?packager}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel} # Other third party repo stuff -%if "%{php_version}" > "7.1" -Obsoletes: php71u-pecl-%{pecl_name} <= %{version} -Obsoletes: php71w-pecl-%{pecl_name} <= %{version} -%endif -%if "%{php_version}" > "7.2" -Obsoletes: php72u-pecl-%{pecl_name} <= %{version} -Obsoletes: php72w-pecl-%{pecl_name} <= %{version} -%endif %if "%{php_version}" > "7.3" Obsoletes: php73-pecl-%{pecl_name} <= %{version} -Obsoletes: php73w-pecl-%{pecl_name} <= %{version} %endif %if "%{php_version}" > "7.4" Obsoletes: php74-pecl-%{pecl_name} <= %{version} -Obsoletes: php74w-pecl-%{pecl_name} <= %{version} %endif +%if "%{php_version}" > "8.0" +Obsoletes: php80-pecl-%{pecl_name} <= %{version} +%endif +%if "%{php_version}" > "8.1" +Obsoletes: php81-pecl-%{pecl_name} <= %{version} %endif - -%if 0%{?fedora} < 20 && 0%{?rhel} < 7 -# Filter shared private -%{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$} -%{?filter_setup} %endif @@ -86,6 +79,8 @@ sed -e 's/role="test"/role="src"/' \ -i package.xml cd NTS +%patch0 -p1 -b .pr14 + # Sanity check, really often broken extver=$(sed -n '/#define PHP_STOMP_VERSION/{s/.* "//;s/".*$//;p}' php_stomp.h) if test "x${extver}" != "x%{version}%{?versuf}"; then @@ -202,6 +197,13 @@ fi --modules | grep -i %{pecl_name} %endif +cd NTS +# need a server, such as rabbitmq-server +: Run upstream test suite +TEST_PHP_EXECUTABLE=%{__php} \ +TEST_PHP_ARGS="-n -d extension=%{buildroot}%{php_extdir}/%{pecl_name}.so" \ +%{__php} -n run-tests.php -q --show-diff + %files %{?_licensedir:%license NTS/LICENSE} @@ -218,6 +220,10 @@ fi %changelog +* Mon Sep 27 2021 Remi Collet <remi@remirepo.net> - 2.0.2-6 +- add patch for PHP 8 from + https://github.com/php/pecl-tools-stomp/pull/14 + * Tue Sep 03 2019 Remi Collet <remi@remirepo.net> - 2.0.2-5 - rebuild for 7.4.0RC1 diff --git a/stomp-php8.patch b/stomp-php8.patch new file mode 100644 index 0000000..46b1f09 --- /dev/null +++ b/stomp-php8.patch @@ -0,0 +1,1639 @@ +From 7b066620afe3368662e316e86242d0087de8a44e Mon Sep 17 00:00:00 2001 +From: Peter Kokot <peterkokot@gmail.com> +Date: Sat, 30 Jun 2018 16:44:34 +0200 +Subject: [PATCH] Remove unused Git attributes ident + +The $Id$ keywords were used in Subversion where they can be substituted +with filename, last revision number change, last changed date, and last +user who changed it. + +In Git this functionality is different and can be done with Git attribute +ident. These need to be defined manually for each file in the +.gitattributes file and are afterwards replaced with 40-character +hexadecimal blob object name which is based only on the particular file +contents. + +This patch simplifes handling of $Id$ keywords by removing them since +they are not used anymore. +--- + config.m4 | 1 - + config.w32 | 1 - + php_stomp.c | 2 -- + php_stomp.h | 2 -- + stomp.c | 2 -- + stomp.h | 2 -- + 6 files changed, 10 deletions(-) + +diff --git a/config.m4 b/config.m4 +index 8a9c36b..f700f27 100644 +--- a/config.m4 ++++ b/config.m4 +@@ -1,4 +1,3 @@ +-dnl $Id$ + dnl config.m4 for extension stomp + + PHP_ARG_ENABLE(stomp, whether to enable stomp support, +diff --git a/config.w32 b/config.w32 +index 091e00b..ba3096b 100644 +--- a/config.w32 ++++ b/config.w32 +@@ -1,4 +1,3 @@ +-// $Id$ + // vim:ft=javascript + + ARG_ENABLE("stomp", "enable stomp support", "no"); +diff --git a/php_stomp.c b/php_stomp.c +index 9442011..080298f 100644 +--- a/php_stomp.c ++++ b/php_stomp.c +@@ -16,8 +16,6 @@ + +----------------------------------------------------------------------+ + */ + +-/* $Id$ */ +- + #ifdef HAVE_CONFIG_H + #include "config.h" + #endif +diff --git a/php_stomp.h b/php_stomp.h +index b799119..805b9f6 100644 +--- a/php_stomp.h ++++ b/php_stomp.h +@@ -16,8 +16,6 @@ + +----------------------------------------------------------------------+ + */ + +-/* $Id$ */ +- + #ifndef PHP_STOMP_H + #define PHP_STOMP_H + +diff --git a/stomp.c b/stomp.c +index 2f71606..d83a4e6 100644 +--- a/stomp.c ++++ b/stomp.c +@@ -16,8 +16,6 @@ + +----------------------------------------------------------------------+ + */ + +-/* $Id$ */ +- + #ifdef HAVE_CONFIG_H + #include "config.h" + #endif +diff --git a/stomp.h b/stomp.h +index a47787f..19bd8dd 100644 +--- a/stomp.h ++++ b/stomp.h +@@ -16,8 +16,6 @@ + +----------------------------------------------------------------------+ + */ + +-/* $Id$ */ +- + #ifndef _STOMP_H_ + #define _STOMP_H_ + + +From 684706756972bb75fec025ec9d66c3fc99ed5199 Mon Sep 17 00:00:00 2001 +From: Peter Kokot <peterkokot@gmail.com> +Date: Wed, 3 Oct 2018 09:43:57 +0200 +Subject: [PATCH] Trim trailing whitespace + +--- + LICENSE | 26 ++++----- + README | 2 +- + TODO | 2 +- + config.m4 | 2 +- + doc/classes.php | 48 ++++++++-------- + doc/functions.php | 44 +++++++-------- + php_stomp.c | 94 ++++++++++++++++---------------- + php_stomp.h | 4 +- + stomp.h | 4 +- + tests/002-version.phpt | 2 +- + tests/003-connect/001.phpt | 2 +- + tests/003-connect/002.phpt | 4 +- + tests/003-connect/003.phpt | 2 +- + tests/004-getSessionId/001.phpt | 4 +- + tests/005-close/001.phpt | 4 +- + tests/005-close/002.phpt | 4 +- + tests/006-send/001.phpt | 2 +- + tests/006-send/002.phpt | 2 +- + tests/006-send/003.phpt | 2 +- + tests/007-subscribe/001.phpt | 2 +- + tests/008-unsubscribe/001.phpt | 2 +- + tests/009-readFrame/001.phpt | 2 +- + tests/009-readFrame/003.phpt | 4 +- + tests/009-readFrame/004.phpt | Bin 433 -> 432 bytes + tests/009-readFrame/006.phpt | 2 +- + tests/010-timeout/001.phpt | 4 +- + tests/010-timeout/002.phpt | 4 +- + tests/011-commit/001.phpt | 2 +- + tests/skipif.inc | 2 +- + 29 files changed, 139 insertions(+), 139 deletions(-) + +diff --git a/LICENSE b/LICENSE +index 6059c80..92ee907 100644 +--- a/LICENSE ++++ b/LICENSE +@@ -1,7 +1,7 @@ +--------------------------------------------------------------------- ++-------------------------------------------------------------------- + The PHP License, version 3.01 + Copyright (c) 1999 - 2014 The PHP Group. All rights reserved. +--------------------------------------------------------------------- ++-------------------------------------------------------------------- + + Redistribution and use in source and binary forms, with or without + modification, is permitted provided that the following conditions +@@ -9,22 +9,22 @@ are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +- ++ + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. +- ++ + 3. The name "PHP" must not be used to endorse or promote products + derived from this software without prior written permission. For + written permission, please contact group@php.net. +- ++ + 4. Products derived from this software may not be called "PHP", nor + may "PHP" appear in their name, without prior written permission + from group@php.net. You may indicate that your software works in + conjunction with PHP by saying "Foo for PHP" instead of calling + it "PHP Foo" or "phpfoo" +- ++ + 5. The PHP Group may publish revised and/or new versions of the + license from time to time. Each version will be given a + distinguishing version number. +@@ -41,27 +41,27 @@ are met: + "This product includes PHP software, freely available from + <http://www.php.net/software/>". + +-THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND ++THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND + ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A ++THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PHP +-DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +-INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ++DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, ++INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + OF THE POSSIBILITY OF SUCH DAMAGE. + +--------------------------------------------------------------------- ++-------------------------------------------------------------------- + + This software consists of voluntary contributions made by many + individuals on behalf of the PHP Group. + + The PHP Group can be contacted via Email at group@php.net. + +-For more information on the PHP Group and the PHP project, ++For more information on the PHP Group and the PHP project, + please see <http://www.php.net>. + + PHP includes the Zend Engine, freely available at +diff --git a/README b/README +index 6511d8b..a0c1953 100644 +--- a/README ++++ b/README +@@ -1,7 +1,7 @@ + stomp + ===== + +-This extension allows php applications to communicate with any Stomp compliant Message Broker(s) through easy object ++This extension allows php applications to communicate with any Stomp compliant Message Broker(s) through easy object + oriented and procedural interfaces. + + This extension currently implements STOMP 1.0 protocol: https://stomp.github.io/stomp-specification-1.0.html +diff --git a/config.m4 b/config.m4 +index f700f27..cbeb71b 100644 +--- a/config.m4 ++++ b/config.m4 +@@ -16,7 +16,7 @@ if test "$PHP_STOMP" != "no"; then + [ + AC_DEFINE(HAVE_STOMP_SSL,1,[ ]) + ], [ +- AC_MSG_ERROR([OpenSSL libraries not found. ++ AC_MSG_ERROR([OpenSSL libraries not found. + + Check the path given to --with-openssl-dir and output in config.log) + ]) +diff --git a/doc/classes.php b/doc/classes.php +index 0cfc554..06c50a0 100644 +--- a/doc/classes.php ++++ b/doc/classes.php +@@ -4,7 +4,7 @@ class Stomp { + + /** + * Connect to server +- * ++ * + * @param string $broker The broker URI + * @param string $username The username + * @param string $password The password +@@ -15,7 +15,7 @@ public function __construct($broker = null, $username = null, $password = null, + + /** + * Get the current stomp session ID +- * ++ * + * @return string stomp session ID if it exists, or FALSE otherwise + */ + public function getSessionId() { +@@ -24,28 +24,28 @@ public function getSessionId() { + /** + * Close stomp connection + * +- * @return boolean TRUE on success, or FALSE on failure ++ * @return boolean TRUE on success, or FALSE on failure + */ + public function disconnect() { + } + +- /** ++ /** + * Sends a message to a destination in the messaging system +- * +- * @param string $destination indicates where to send the message ++ * ++ * @param string $destination indicates where to send the message + * @param string|StompFrame $msg message to be sent + * @param array $headers additional headers (example: receipt). +- * @return boolean TRUE on success, or FALSE on failure ++ * @return boolean TRUE on success, or FALSE on failure + */ + public function send($destination, $msg, array $headers = array()) { + } + + /** + * Register to listen to a given destination +- * +- * @param string $destination indicates which destination to subscribe to ++ * ++ * @param string $destination indicates which destination to subscribe to + * @param array $headers additional headers (example: receipt). +- * @return boolean TRUE on success, or FALSE on failure ++ * @return boolean TRUE on success, or FALSE on failure + */ + public function subscribe($destination, array $headers = array()) { + } +@@ -55,14 +55,14 @@ public function subscribe($destination, array $headers = array()) { + * + * @param string $destination indicates which subscription to remove + * @param array $headers additional headers (example: receipt). +- * @return boolean TRUE on success, or FALSE on failure ++ * @return boolean TRUE on success, or FALSE on failure + */ + public function unsubscribe($destination, array $headers = array()) { + } + + /** + * Indicate whether or not there is a frame ready to read +- * ++ * + * @return boolean TRUE if there is one, or FALSE otherwise + */ + public function hasFrame() { +@@ -81,7 +81,7 @@ public function readFrame($className = 'stompFrame') { + * Start a transaction + * + * @param string $transaction_id transaction id +- * @return boolean TRUE on success, or FALSE on failure ++ * @return boolean TRUE on success, or FALSE on failure + */ + public function begin($transaction_id) { + } +@@ -90,26 +90,26 @@ public function begin($transaction_id) { + * Commit a transaction in progress + * + * @param string $transaction_id transaction id +- * @return boolean TRUE on success, or FALSE on failure ++ * @return boolean TRUE on success, or FALSE on failure + */ +- public function commit($transaction_id) { ++ public function commit($transaction_id) { + } + + /** + * Roll back a transaction in progress + * + * @param string $transaction_id transaction id +- * @return boolean TRUE on success, or FALSE on failure ++ * @return boolean TRUE on success, or FALSE on failure + */ + public function abort($transaction_id) { + } + + /** + * Acknowledge consumption of a message from a subscription using client acknowledgment +- * ++ * + * @param string|StompFrame $msg message/messageId to be acknowledged + * @param array $headers additional headers (example: receipt). +- * @return boolean TRUE on success, or FALSE on failure ++ * @return boolean TRUE on success, or FALSE on failure + */ + public function ack($msg, array $headers = array()) { + } +@@ -124,7 +124,7 @@ public function error() { + + /** + * Set timeout +- * ++ * + * @param int $seconds the seconds part of the timeout to be set + * @param int $microseconds the microseconds part of the timeout to be set + * @return void +@@ -134,16 +134,16 @@ public function setTimeout($seconds, $microseconds = 0) { + + /** + * Get timeout +- * ++ * + * @return array Array with timeout informations + */ + public function getTimeout() { +- } ++ } + + } + + class StompFrame { +- ++ + /** + * Frame Command + * @var String +@@ -164,11 +164,11 @@ class StompFrame { + } + + class StompException extends Exception { +- ++ + /** + * Get the stomp server error details + * +- * @return string ++ * @return string + */ + public function getDetails() { + } +diff --git a/doc/functions.php b/doc/functions.php +index 98486fc..57ae424 100644 +--- a/doc/functions.php ++++ b/doc/functions.php +@@ -2,7 +2,7 @@ + + /** + * Get the current version of the stomp extension +- * ++ * + * @return string version + */ + function stomp_version() { +@@ -10,19 +10,19 @@ function stomp_version() { + + /** + * Connect to server +- * ++ * + * @param string $broker broker URI + * @param string $username The username + * @param string $password The password + * @param array $headers additional headers (example: receipt). +- * @return Ressource stomp connection identifier on success, or FALSE on failure ++ * @return Ressource stomp connection identifier on success, or FALSE on failure + */ + function stomp_connect($broker = null, $username = null, $password = null, array $headers = array()) { + } + + /** + * Get the current stomp session ID +- * ++ * + * @param ressource $link identifier returned by stomp_connect + * @return string stomp session ID if it exists, or FALSE otherwise + */ +@@ -33,30 +33,30 @@ function stomp_get_session_id($link) { + * Close stomp connection + * + * @param ressource $link identifier returned by stomp_connect +- * @return boolean TRUE on success, or FALSE on failure ++ * @return boolean TRUE on success, or FALSE on failure + */ + function stomp_close($link) { + } + +-/** ++/** + * Sends a message to a destination in the messaging system +- * ++ * + * @param ressource $link identifier returned by stomp_connect +- * @param string $destination indicates where to send the message ++ * @param string $destination indicates where to send the message + * @param string|StompFrame $msg message to be sent + * @param array $headers additional headers (example: receipt). +- * @return boolean TRUE on success, or FALSE on failure ++ * @return boolean TRUE on success, or FALSE on failure + */ + function stomp_send($link, $destination, $msg, array $headers = array()) { + } + + /** + * Register to listen to a given destination +- * ++ * + * @param ressource $link identifier returned by stomp_connect +- * @param string $destination indicates which destination to subscribe to ++ * @param string $destination indicates which destination to subscribe to + * @param array $headers additional headers (example: receipt). +- * @return boolean TRUE on success, or FALSE on failure ++ * @return boolean TRUE on success, or FALSE on failure + */ + function stomp_subscribe($link, $destination, array $headers = array()) { + } +@@ -67,14 +67,14 @@ function stomp_subscribe($link, $destination, array $headers = array()) { + * @param ressource $link identifier returned by stomp_connect + * @param string $destination indicates which subscription to remove + * @param array $headers additional headers (example: receipt). +- * @return boolean TRUE on success, or FALSE on failure ++ * @return boolean TRUE on success, or FALSE on failure + */ + function stomp_unsubscribe($link, $destination, array $headers = array()) { + } + + /** + * Indicate whether or not there is a frame ready to read +- * ++ * + * @param ressource $link identifier returned by stomp_connect + * @return boolean TRUE if there is one, or FALSE otherwise + */ +@@ -95,7 +95,7 @@ function stomp_read_frame($link) { + * + * @param ressource $link identifier returned by stomp_connect + * @param string $transaction_id transaction id +- * @return boolean TRUE on success, or FALSE on failure ++ * @return boolean TRUE on success, or FALSE on failure + */ + function stomp_begin($link, $transaction_id) { + } +@@ -105,9 +105,9 @@ function stomp_begin($link, $transaction_id) { + * + * @param ressource $link identifier returned by stomp_connect + * @param string $transaction_id transaction id +- * @return boolean TRUE on success, or FALSE on failure ++ * @return boolean TRUE on success, or FALSE on failure + */ +-function stomp_commit($link, $transaction_id) { ++function stomp_commit($link, $transaction_id) { + } + + /** +@@ -115,18 +115,18 @@ function stomp_commit($link, $transaction_id) { + * + * @param ressource $link identifier returned by stomp_connect + * @param string $transaction_id transaction id +- * @return boolean TRUE on success, or FALSE on failure ++ * @return boolean TRUE on success, or FALSE on failure + */ + function stomp_abort($link, $transaction_id) { + } + + /** + * Acknowledge consumption of a message from a subscription using client acknowledgment +- * ++ * + * @param ressource $link identifier returned by stomp_connect + * @param string|StompFrame $msg message/messageId to be acknowledged + * @param array $headers additional headers (example: receipt). +- * @return boolean TRUE on success, or FALSE on failure ++ * @return boolean TRUE on success, or FALSE on failure + */ + function stomp_ack($link, $msg, array $headers = array()) { + } +@@ -142,7 +142,7 @@ function stomp_error($link) { + + /** + * Set timeout +- * ++ * + * @param ressource $link identifier returned by stomp_connect + * @param int $seconds the seconds part of the timeout to be set + * @param int $microseconds the microseconds part of the timeout to be set +@@ -153,7 +153,7 @@ function stomp_set_timeout($link, $seconds, $microseconds = 0) { + + /** + * Get timeout +- * ++ * + * @param ressource $link identifier returned by stomp_connect + * @return array Array with timeout informations + */ +diff --git a/php_stomp.c b/php_stomp.c +index 080298f..0dcefed 100644 +--- a/php_stomp.c ++++ b/php_stomp.c +@@ -83,7 +83,7 @@ + STOMP_G(error_msg) = estrdup(msg); \ + if (stomp_object) { \ + zend_throw_exception_ex(stomp_ce_exception, errno , msg); \ +- } ++ } + + #define STOMP_ERROR_DETAILS(errno, msg, details) \ + STOMP_G(error_no) = errno; \ +@@ -157,7 +157,7 @@ ZEND_ARG_ARRAY_INFO(0, headers, 1) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(stomp_readframe_args, 0, 0, 1) +-ZEND_ARG_INFO(0, link) ++ZEND_ARG_INFO(0, link) + ZEND_ARG_INFO(0, class_name) + ZEND_END_ARG_INFO() + +@@ -213,7 +213,7 @@ ZEND_BEGIN_ARG_INFO_EX(stomp_frame_construct_args, 0, 0, 0) + ZEND_ARG_INFO(0, command) + ZEND_ARG_ARRAY_INFO(0, headers, 1) + ZEND_ARG_INFO(0, body) +-ZEND_END_ARG_INFO() ++ZEND_END_ARG_INFO() + /* }}} */ + + /* {{{ stomp_functions */ +@@ -267,7 +267,7 @@ static zend_function_entry stomp_frame_methods[] = { + PHP_ME(stompframe, __construct, stomp_frame_construct_args, ZEND_ACC_PUBLIC) + {NULL, NULL, NULL} + }; +-/* }}} */ ++/* }}} */ + + /* {{{ stomp_exception_methods[] */ + static zend_function_entry stomp_exception_methods[] = { +@@ -283,7 +283,7 @@ zend_module_entry stomp_module_entry = { + stomp_functions, + PHP_MINIT(stomp), + PHP_MSHUTDOWN(stomp), +- PHP_RINIT(stomp), ++ PHP_RINIT(stomp), + PHP_RSHUTDOWN(stomp), + PHP_MINFO(stomp), + PHP_STOMP_VERSION, +@@ -330,9 +330,9 @@ ZEND_GET_MODULE(stomp) + /* {{{ constructor/destructor */ + static void stomp_send_disconnect(stomp_t *stomp) + { +- stomp_frame_t frame = {0}; ++ stomp_frame_t frame = {0}; + INIT_FRAME(frame, "DISCONNECT"); +- ++ + stomp_send(stomp, &frame ); + CLEAR_FRAME(frame); + } +@@ -342,7 +342,7 @@ static void php_destroy_stomp_res(zend_resource *rsrc) + stomp_t *stomp = (stomp_t *) rsrc->ptr; + stomp_send_disconnect(stomp ); + stomp_close(stomp); +-} ++} + + static zend_object *php_stomp_new(zend_class_entry *ce) + { +@@ -350,7 +350,7 @@ static zend_object *php_stomp_new(zend_class_entry *ce) + + intern = (stomp_object_t *) ecalloc(1, sizeof(stomp_object_t) + zend_object_properties_size(ce)); + intern->stomp = NULL; +- ++ + zend_object_std_init(&intern->std, ce ); + + intern->std.handlers = &stomp_obj_handlers; +@@ -381,7 +381,7 @@ PHP_MINIT_FUNCTION(stomp) + /* Properties */ + zend_declare_property_null(stomp_ce_frame, "command", sizeof("command")-1, ZEND_ACC_PUBLIC ); + zend_declare_property_null(stomp_ce_frame, "headers", sizeof("headers")-1, ZEND_ACC_PUBLIC ); +- zend_declare_property_null(stomp_ce_frame, "body", sizeof("body")-1, ZEND_ACC_PUBLIC ); ++ zend_declare_property_null(stomp_ce_frame, "body", sizeof("body")-1, ZEND_ACC_PUBLIC ); + + /* Register StompException class */ + INIT_CLASS_ENTRY(ce, PHP_STOMP_EXCEPTION_CLASSNAME, stomp_exception_methods); +@@ -399,7 +399,7 @@ PHP_MINIT_FUNCTION(stomp) + + /* {{{ PHP_MSHUTDOWN_FUNCTION */ + PHP_MSHUTDOWN_FUNCTION(stomp) +-{ ++{ + /* Unregister INI entries */ + UNREGISTER_INI_ENTRIES(); + return SUCCESS; +@@ -443,9 +443,9 @@ PHP_MINFO_FUNCTION(stomp) + } + /* }}} */ + +-/* {{{ proto string stomp_version() ++/* {{{ proto string stomp_version() + Get stomp extension version */ +-PHP_FUNCTION(stomp_version) ++PHP_FUNCTION(stomp_version) + { + RETURN_STRINGL(PHP_STOMP_VERSION, sizeof(PHP_STOMP_VERSION)-1); + } +@@ -461,9 +461,9 @@ PHP_FUNCTION(stomp_connect) + zend_string *broker = NULL, *username = NULL, *password = NULL; + php_url *url_parts; + +-#ifdef HAVE_STOMP_SSL ++#ifdef HAVE_STOMP_SSL + int use_ssl = 0; +-#endif ++#endif + + if (zend_parse_parameters(ZEND_NUM_ARGS() , "|SSSa!", &broker, &username, &password, &headers) == FAILURE) { + return; +@@ -478,7 +478,7 @@ PHP_FUNCTION(stomp_connect) + } + + url_parts = php_url_parse_ex(ZSTR_VAL(broker), ZSTR_LEN(broker)); +- ++ + if (!url_parts || !url_parts->host) { + STOMP_ERROR(0, PHP_STOMP_ERR_INVALID_BROKER_URI); + zend_string_release(broker); +@@ -495,7 +495,7 @@ PHP_FUNCTION(stomp_connect) + STOMP_ERROR(0, "SSL DISABLED"); + php_url_free(url_parts); + return; +-#endif ++#endif + } else if (strcmp(STOMP_URL_STR(url_parts->scheme), "tcp") != 0) { + STOMP_ERROR(0, PHP_STOMP_ERR_INVALID_BROKER_URI_SCHEME); + php_url_free(url_parts); +@@ -507,7 +507,7 @@ PHP_FUNCTION(stomp_connect) + + #if HAVE_STOMP_SSL + stomp->options.use_ssl = use_ssl; +-#endif ++#endif + + stomp->options.read_timeout_sec = STOMP_G(read_timeout_sec); + stomp->options.read_timeout_usec = STOMP_G(read_timeout_usec); +@@ -522,7 +522,7 @@ PHP_FUNCTION(stomp_connect) + stomp_frame_t *res; + stomp_frame_t frame = {0}; + int send_status; +- ++ + INIT_FRAME(frame, "CONNECT"); + if (!username) { + username = zend_string_init(STOMP_G(default_username), strlen(STOMP_G(default_username)), 0); +@@ -548,7 +548,7 @@ PHP_FUNCTION(stomp_connect) + ZVAL_STR(&rv, zend_string_copy(password)); + zend_hash_str_add(frame.headers, "passcode", sizeof("passcode"), &rv); + } +- ++ + zend_string_release(username); + zend_string_release(password); + +@@ -607,7 +607,7 @@ PHP_FUNCTION(stomp_connect) + i_obj->stomp = stomp; + RETURN_TRUE; + } +- } ++ } + } else { + STOMP_ERROR_DETAILS(0, stomp->error, stomp->error_details); + } +@@ -617,9 +617,9 @@ PHP_FUNCTION(stomp_connect) + } + /* }}} */ + +-/* {{{ proto string stomp_connect_error() ++/* {{{ proto string stomp_connect_error() + Get the last connection error */ +-PHP_FUNCTION(stomp_connect_error) ++PHP_FUNCTION(stomp_connect_error) + { + if (STOMP_G(error_msg)) { + RETURN_STRING(STOMP_G(error_msg)); +@@ -629,7 +629,7 @@ PHP_FUNCTION(stomp_connect_error) + } + /* }}} */ + +-/* {{{ proto string Stomp::getSessionId() ++/* {{{ proto string Stomp::getSessionId() + Get the current stomp session ID */ + PHP_FUNCTION(stomp_get_session_id) + { +@@ -695,13 +695,13 @@ PHP_FUNCTION(stomp_send) + stomp_t *stomp = NULL; + zend_string *destination; + zval *msg, *headers = NULL, rv; +- stomp_frame_t frame = {0}; ++ stomp_frame_t frame = {0}; + int success = 0; + + if (stomp_object) { + if (zend_parse_parameters(ZEND_NUM_ARGS() , "Sz|a!", &destination, &msg, &headers) == FAILURE) { + return; +- } ++ } + FETCH_STOMP_OBJECT; + } else { + zval *arg; +@@ -718,7 +718,7 @@ PHP_FUNCTION(stomp_send) + } + + INIT_FRAME(frame, "SEND"); +- ++ + /* Translate a PHP array to a stomp_header array */ + if (NULL != headers) { + FRAME_HEADER_FROM_HASHTABLE(frame.headers, Z_ARRVAL_P(headers)); +@@ -727,7 +727,7 @@ PHP_FUNCTION(stomp_send) + /* Add the destination */ + ZVAL_STR(&rv, zend_string_copy(destination)); + zend_hash_str_add(frame.headers, "destination", sizeof("destination") - 1, &rv); +- ++ + if (Z_TYPE_P(msg) == IS_STRING) { + frame.body = Z_STRVAL_P(msg); + frame.body_length = Z_STRLEN_P(msg); +@@ -770,7 +770,7 @@ PHP_FUNCTION(stomp_subscribe) + stomp_t *stomp = NULL; + zend_string *destination; + zval *headers = NULL, rv; +- stomp_frame_t frame = {0}; ++ stomp_frame_t frame = {0}; + int success = 0; + + if (stomp_object) { +@@ -793,7 +793,7 @@ PHP_FUNCTION(stomp_subscribe) + } + + INIT_FRAME(frame, "SUBSCRIBE"); +- ++ + /* Translate a PHP array to a stomp_header array */ + if (NULL != headers) { + FRAME_HEADER_FROM_HASHTABLE(frame.headers, Z_ARRVAL_P(headers)); +@@ -824,7 +824,7 @@ PHP_FUNCTION(stomp_unsubscribe) + stomp_t *stomp = NULL; + zend_string *destination; + zval *headers = NULL, rv; +- stomp_frame_t frame = {0}; ++ stomp_frame_t frame = {0}; + int success = 0; + + if (stomp_object) { +@@ -847,7 +847,7 @@ PHP_FUNCTION(stomp_unsubscribe) + } + + INIT_FRAME(frame, "UNSUBSCRIBE"); +- ++ + /* Translate a PHP array to a stomp_header array */ + if (NULL != headers) { + FRAME_HEADER_FROM_HASHTABLE(frame.headers, Z_ARRVAL_P(headers)); +@@ -866,9 +866,9 @@ PHP_FUNCTION(stomp_unsubscribe) + } + /* }}} */ + +-/* {{{ proto boolean Stomp::hasFrame() ++/* {{{ proto boolean Stomp::hasFrame() + Indicate whether or not there is a frame ready to read */ +-PHP_FUNCTION(stomp_has_frame) ++PHP_FUNCTION(stomp_has_frame) + { + zval *stomp_object = getThis(); + stomp_t *stomp = NULL; +@@ -886,7 +886,7 @@ PHP_FUNCTION(stomp_has_frame) + } + /* }}} */ + +-/* {{{ proto StompFrame Stomp::readFrame() ++/* {{{ proto StompFrame Stomp::readFrame() + Read the next frame */ + PHP_FUNCTION(stomp_read_frame) + { +@@ -947,7 +947,7 @@ PHP_FUNCTION(stomp_read_frame) + zend_hash_update(Z_ARRVAL(headers), key, val); + } ZEND_HASH_FOREACH_END(); + } +- ++ + if (ce) { + zend_fcall_info fci; + zend_fcall_info_cache fcc; +@@ -1029,14 +1029,14 @@ static void _php_stomp_transaction(INTERNAL_FUNCTION_PARAMETERS, char *cmd, size + zval *stomp_object = getThis(); + stomp_t *stomp = NULL; + zend_string *transaction_id; +- stomp_frame_t frame = {0}; ++ stomp_frame_t frame = {0}; + int success = 0; + zval *headers = NULL, rv; + + if (stomp_object) { + if (zend_parse_parameters(ZEND_NUM_ARGS() , "S|a", &transaction_id, &headers) == FAILURE) { + return; +- } ++ } + FETCH_STOMP_OBJECT; + } else { + zval *arg; +@@ -1091,19 +1091,19 @@ PHP_FUNCTION(stomp_abort) + } + /* }}} */ + +-/* {{{ _php_stomp_acknowledgment ++/* {{{ _php_stomp_acknowledgment + */ + static void _php_stomp_acknowledgment(INTERNAL_FUNCTION_PARAMETERS, char *cmd) { + zval *stomp_object = getThis(); + zval *msg, *headers = NULL; + stomp_t *stomp = NULL; +- stomp_frame_t frame = {0}; ++ stomp_frame_t frame = {0}; + int success = 0; + + if (stomp_object) { + if (zend_parse_parameters(ZEND_NUM_ARGS() , "z|a!", &msg, &headers) == FAILURE) { + return; +- } ++ } + FETCH_STOMP_OBJECT; + } else { + zval *arg; +@@ -1135,7 +1135,7 @@ static void _php_stomp_acknowledgment(INTERNAL_FUNCTION_PARAMETERS, char *cmd) { + CLEAR_FRAME(frame); + RETURN_FALSE; + } +- ++ + if (stomp_send(stomp, &frame ) > 0) { + success = stomp_valid_receipt(stomp, &frame); + } +@@ -1161,7 +1161,7 @@ PHP_FUNCTION(stomp_nack) + } + /* }}} */ + +-/* {{{ proto string Stomp::error() ++/* {{{ proto string Stomp::error() + Get the last error message */ + PHP_FUNCTION(stomp_error) + { +@@ -1205,7 +1205,7 @@ PHP_FUNCTION(stomp_set_read_timeout) + if (zend_parse_parameters(ZEND_NUM_ARGS() , "l|l", &sec, &usec) == FAILURE) { + return; + } +- FETCH_STOMP_OBJECT; ++ FETCH_STOMP_OBJECT; + } else { + zval *arg; + if (zend_parse_parameters(ZEND_NUM_ARGS() , "rl|l", &arg, &sec, &usec) == FAILURE) { +@@ -1219,14 +1219,14 @@ PHP_FUNCTION(stomp_set_read_timeout) + } + /* }}} */ + +-/* {{{ proto array Stomp::getTimeout() ++/* {{{ proto array Stomp::getTimeout() + Get the timeout */ + PHP_FUNCTION(stomp_get_read_timeout) + { + zval *stomp_object = getThis(); + stomp_t *stomp = NULL; + if (stomp_object) { +- FETCH_STOMP_OBJECT; ++ FETCH_STOMP_OBJECT; + } else { + zval *arg; + if (zend_parse_parameters(ZEND_NUM_ARGS() , "r", &arg) == FAILURE) { +@@ -1270,7 +1270,7 @@ PHP_METHOD(stompframe, __construct) + Get error details */ + PHP_METHOD(stompexception, getDetails) + { +- zval *object = getThis(); ++ zval *object = getThis(); + zval rv, *details = zend_read_property(stomp_ce_exception, object, "details", sizeof("details")-1, 1, &rv); + RETURN_STR(zval_get_string(details)); + } +diff --git a/php_stomp.h b/php_stomp.h +index 805b9f6..fdaaa3e 100644 +--- a/php_stomp.h ++++ b/php_stomp.h +@@ -24,7 +24,7 @@ + typedef struct _stomp_object { + stomp_t *stomp; + zend_object std; +-} stomp_object_t; ++} stomp_object_t; + + #define PHP_STOMP_EXTNAME "Stomp" + #define PHP_STOMP_VERSION "2.0.2" +@@ -104,7 +104,7 @@ ZEND_END_MODULE_GLOBALS(stomp) + #define STOMP_G(v) TSRMG(stomp_globals_id, zend_stomp_globals *, v) + #else + #define STOMP_G(v) (stomp_globals.v) +-#endif ++#endif + + #endif /* PHP_STOMP_H */ + +diff --git a/stomp.h b/stomp.h +index 19bd8dd..1a422b7 100644 +--- a/stomp.h ++++ b/stomp.h +@@ -40,7 +40,7 @@ typedef struct _stomp_options { + long read_timeout_usec; + #if HAVE_STOMP_SSL + int use_ssl; +-#endif ++#endif + } stomp_options_t; + + typedef struct _stomp_frame { +@@ -57,7 +57,7 @@ typedef struct _stomp_frame_stack { + } stomp_frame_stack_t; + + typedef struct _stomp { +- php_socket_t fd; ++ php_socket_t fd; + php_sockaddr_storage localaddr; + stomp_options_t options; + char *host; +diff --git a/tests/002-version.phpt b/tests/002-version.phpt +index d3779aa..6e30db1 100644 +--- a/tests/002-version.phpt ++++ b/tests/002-version.phpt +@@ -3,7 +3,7 @@ Test stomp_version() + --SKIPIF-- + <?php if (!extension_loaded("stomp")) print "skip"; ?> + --FILE-- +-<?php ++<?php + echo stomp_version(); + ?> + --EXPECTF-- +diff --git a/tests/003-connect/001.phpt b/tests/003-connect/001.phpt +index 31b48c1..1e3c968 100644 +--- a/tests/003-connect/001.phpt ++++ b/tests/003-connect/001.phpt +@@ -3,7 +3,7 @@ Test stomp_connect() - URI validation + --SKIPIF-- + <?php if (!extension_loaded("stomp")) print "skip"; ?> + --FILE-- +-<?php ++<?php + var_dump(stomp_connect(''), stomp_connect_error()); + var_dump(stomp_connect(1), stomp_connect_error()); + var_dump(stomp_connect('foo'), stomp_connect_error()); +diff --git a/tests/003-connect/002.phpt b/tests/003-connect/002.phpt +index 6c40f37..4d05989 100644 +--- a/tests/003-connect/002.phpt ++++ b/tests/003-connect/002.phpt +@@ -1,12 +1,12 @@ + --TEST-- +-Test stomp_connect() - Test connection ++Test stomp_connect() - Test connection + --SKIPIF-- + <?php + $require_connection = true; + include dirname(__DIR__). "/skipif.inc"; + ?> + --FILE-- +-<?php ++<?php + include dirname(__DIR__) . "/config.inc"; + var_dump(stomp_connect(STOMP_ADDRESS)); + var_dump(stomp_connect_error()); +diff --git a/tests/003-connect/003.phpt b/tests/003-connect/003.phpt +index eb25a40..b3de8d6 100644 +--- a/tests/003-connect/003.phpt ++++ b/tests/003-connect/003.phpt +@@ -5,7 +5,7 @@ Test stomp_connect() - Test error on CONNECT + include "../skipif.inc" + ?> + --FILE-- +-<?php ++<?php + try { + $stomp = new Stomp('tcp://localhost', 'anotpresentusername1234'); + } catch (Exception $e) { +diff --git a/tests/004-getSessionId/001.phpt b/tests/004-getSessionId/001.phpt +index a798a1a..08b92a9 100644 +--- a/tests/004-getSessionId/001.phpt ++++ b/tests/004-getSessionId/001.phpt +@@ -1,12 +1,12 @@ + --TEST-- + Test stomp_get_session_id() + --SKIPIF-- +-<?php ++<?php + $require_connection = true; + include dirname(__DIR__) . '/skipif.inc'; + ?> + --FILE-- +-<?php ++<?php + include dirname(__DIR__) . "/config.inc"; + $link = stomp_connect(STOMP_ADDRESS); + var_dump(stomp_get_session_id($link)); +diff --git a/tests/005-close/001.phpt b/tests/005-close/001.phpt +index 9e46e78..0a23a59 100644 +--- a/tests/005-close/001.phpt ++++ b/tests/005-close/001.phpt +@@ -1,11 +1,11 @@ + --TEST-- + Test stomp_close() - tests parameters + --SKIPIF-- +-<?php ++<?php + include dirname(__DIR__) . "/skipif.inc"; + ?> + --FILE-- +-<?php ++<?php + stomp_close(null); + ?> + --EXPECTF-- +diff --git a/tests/005-close/002.phpt b/tests/005-close/002.phpt +index b24c197..b3dbd95 100644 +--- a/tests/005-close/002.phpt ++++ b/tests/005-close/002.phpt +@@ -1,12 +1,12 @@ + --TEST-- + Test stomp_close() + --SKIPIF-- +-<?php ++<?php + $require_connection = true; + include dirname(__DIR__) . "/skipif.inc"; + ?> + --FILE-- +-<?php ++<?php + include dirname(__DIR__) . "/config.inc"; + $link = stomp_connect(STOMP_ADDRESS); + if($link) echo "success" . PHP_EOL; +diff --git a/tests/006-send/001.phpt b/tests/006-send/001.phpt +index 65cc607..82b29c6 100644 +--- a/tests/006-send/001.phpt ++++ b/tests/006-send/001.phpt +@@ -6,7 +6,7 @@ $require_connection = true; + include dirname(__DIR__) . "/skipif.inc"; + ?> + --FILE-- +-<?php ++<?php + include dirname(__DIR__) . "/skipif.inc"; + + $link = stomp_connect(STOMP_ADDRESS); +diff --git a/tests/006-send/002.phpt b/tests/006-send/002.phpt +index 35da23e..6301c39 100644 +--- a/tests/006-send/002.phpt ++++ b/tests/006-send/002.phpt +@@ -6,7 +6,7 @@ $require_connection = true; + include dirname(__DIR__) . "/skipif.inc"; + ?> + --FILE-- +-<?php ++<?php + + include dirname(__DIR__) . "/config.inc"; + +diff --git a/tests/006-send/003.phpt b/tests/006-send/003.phpt +index 5a4d384..14f2745 100644 +--- a/tests/006-send/003.phpt ++++ b/tests/006-send/003.phpt +@@ -6,7 +6,7 @@ $require_connection = true; + include dirname(__DIR__) . "/skipif.inc"; + ?> + --FILE-- +-<?php ++<?php + include dirname(__DIR__) . "/skipif.inc"; + $s = new Stomp(STOMP_ADDRESS); + var_dump($s->send('/queue/test-06', 'A real message', array('receipt' => 'message-12345'))); +diff --git a/tests/007-subscribe/001.phpt b/tests/007-subscribe/001.phpt +index 644c404..8d190dd 100644 +--- a/tests/007-subscribe/001.phpt ++++ b/tests/007-subscribe/001.phpt +@@ -6,7 +6,7 @@ $require_connection = true; + include dirname(__DIR__) . "/skipif.inc"; + ?> + --FILE-- +-<?php ++<?php + include dirname(__DIR__) . "/skipif.inc"; + + $s = new Stomp(STOMP_ADDRESS); +diff --git a/tests/008-unsubscribe/001.phpt b/tests/008-unsubscribe/001.phpt +index 647d7a5..c1200eb 100644 +--- a/tests/008-unsubscribe/001.phpt ++++ b/tests/008-unsubscribe/001.phpt +@@ -6,7 +6,7 @@ $require_connection = true; + include dirname(__DIR__) . "/skipif.inc"; + ?> + --FILE-- +-<?php ++<?php + include dirname(__DIR__) . "/config.inc"; + + $s = new Stomp(STOMP_ADDRESS); +diff --git a/tests/009-readFrame/001.phpt b/tests/009-readFrame/001.phpt +index fe600b3..e67bad6 100644 +--- a/tests/009-readFrame/001.phpt ++++ b/tests/009-readFrame/001.phpt +@@ -6,7 +6,7 @@ $require_connection = true; + include dirname(__DIR__) . "/skipif.inc"; + ?> + --FILE-- +-<?php ++<?php + include dirname(__DIR__) . "/config.inc"; + + $s = new Stomp(STOMP_ADDRESS); +diff --git a/tests/009-readFrame/003.phpt b/tests/009-readFrame/003.phpt +index f1e29b6..6e61254 100644 +--- a/tests/009-readFrame/003.phpt ++++ b/tests/009-readFrame/003.phpt +@@ -1,12 +1,12 @@ + --TEST-- +-Test stomp::readFrame() - custom frame class ++Test stomp::readFrame() - custom frame class + --SKIPIF-- + <?php + $require_connection = true; + include dirname(__DIR__) . "/skipif.inc"; + ?> + --FILE-- +-<?php ++<?php + + include dirname(__DIR__) . "/config.inc"; + +diff --git a/tests/009-readFrame/006.phpt b/tests/009-readFrame/006.phpt +index 0d1ffc4..e90ee80 100644 +--- a/tests/009-readFrame/006.phpt ++++ b/tests/009-readFrame/006.phpt +@@ -6,7 +6,7 @@ $require_connection = true; + include dirname(__DIR__) . "/skipif.inc"; + ?> + --FILE-- +-<?php ++<?php + + include dirname(__DIR__) . "/config.inc"; + +diff --git a/tests/010-timeout/001.phpt b/tests/010-timeout/001.phpt +index 8256baa..7389f70 100644 +--- a/tests/010-timeout/001.phpt ++++ b/tests/010-timeout/001.phpt +@@ -5,11 +5,11 @@ stomp.default_read_timeout_sec=5 + stomp.default_read_timeout_usec=5 + --SKIPIF-- + <?php +- if (!extension_loaded("stomp")) print "skip"; ++ if (!extension_loaded("stomp")) print "skip"; + if (!stomp_connect()) print "skip"; + ?> + --FILE-- +-<?php ++<?php + $s = new Stomp(); + + // First test, read from ini variables, expected to return 5.5 +diff --git a/tests/010-timeout/002.phpt b/tests/010-timeout/002.phpt +index 65d3c28..a150cb8 100644 +--- a/tests/010-timeout/002.phpt ++++ b/tests/010-timeout/002.phpt +@@ -5,11 +5,11 @@ stomp.default_read_timeout_sec=5 + stomp.default_read_timeout_usec=5 + --SKIPIF-- + <?php +- if (!extension_loaded("stomp")) print "skip"; ++ if (!extension_loaded("stomp")) print "skip"; + if (!stomp_connect()) print "skip"; + ?> + --FILE-- +-<?php ++<?php + $link = stomp_connect(); + + // First test, read from ini variables, expected to return 5.5 +diff --git a/tests/011-commit/001.phpt b/tests/011-commit/001.phpt +index 3636095..33dd57d 100644 +--- a/tests/011-commit/001.phpt ++++ b/tests/011-commit/001.phpt +@@ -6,7 +6,7 @@ $require_connection = true; + include dirname(__DIR__) . "/skipif.inc"; + ?> + --FILE-- +-<?php ++<?php + + include dirname(__DIR__) . "/config.inc"; + +diff --git a/tests/skipif.inc b/tests/skipif.inc +index 033a4be..858dd49 100644 +--- a/tests/skipif.inc ++++ b/tests/skipif.inc +@@ -2,7 +2,7 @@ + include __DIR__ . "/config.inc"; + + if (!extension_loaded("stomp")) { +- print "skip"; ++ print "skip"; + } + if (isset($require_connection) && $require_connection) { + $stomp = stomp_connect(STOMP_ADDRESS); + +From 13681a79d9389603d9788802f0a114671a753df1 Mon Sep 17 00:00:00 2001 +From: Remi Collet <remi@remirepo.net> +Date: Fri, 25 Sep 2020 16:06:39 +0200 +Subject: [PATCH 1/2] Fix compatibility with PHP 8 - cleanup remaining TSRMLS + macros - fix read/update_property parameters - adapt test suite for exception + in arg. parsing - fix callback + +--- + php_stomp.c | 38 ++++++++++++++++++++-------------- + stomp.c | 6 +++--- + stomp.h | 4 ++-- + tests/003-connect/003.phpt | 2 +- + tests/005-close/001.phpt | 8 +++++-- + tests/007-subscribe/001.phpt | 2 +- + tests/008-unsubscribe/001.phpt | 2 +- + tests/010-timeout/001.phpt | 24 ++++++++++++--------- + tests/010-timeout/002.phpt | 26 ++++++++++++++--------- + 9 files changed, 67 insertions(+), 45 deletions(-) + +diff --git a/php_stomp.c b/php_stomp.c +index 0dcefed..b99a9ff 100644 +--- a/php_stomp.c ++++ b/php_stomp.c +@@ -95,7 +95,7 @@ + zval _object, *object = &_object; \ + THROW_STOMP_EXCEPTION(object, errno, msg) \ + if (details) { \ +- zend_update_property_string(stomp_ce_exception, object, "details", sizeof("details")-1, (char *) details ); \ ++ zend_update_property_string(stomp_ce_exception, OBJ_FOR_PROP(object), "details", sizeof("details")-1, (char *) details ); \ + } \ + } + +@@ -105,6 +105,12 @@ + #define STOMP_URL_STR(a) ZSTR_VAL(a) + #endif + ++#if PHP_VERSION_ID < 80000 ++#define OBJ_FOR_PROP(zv) (zv) ++#else ++#define OBJ_FOR_PROP(zv) Z_OBJ_P(zv) ++#endif ++ + static int le_stomp; + static zend_object_handlers stomp_obj_handlers; + +@@ -562,7 +568,7 @@ PHP_FUNCTION(stomp_connect) + zval excobj; + THROW_STOMP_EXCEPTION(&excobj, stomp->errnum, stomp->error); + if (stomp->error_details) { +- zend_update_property_string(stomp_ce_exception, &excobj, "details", sizeof("details")-1, stomp->error_details ); ++ zend_update_property_string(stomp_ce_exception, OBJ_FOR_PROP(&excobj), "details", sizeof("details")-1, stomp->error_details ); + } + return; + } +@@ -576,7 +582,7 @@ PHP_FUNCTION(stomp_connect) + if ((error_msg = zend_hash_str_find(res->headers, ZEND_STRL("message"))) != NULL) { + THROW_STOMP_EXCEPTION(&excobj, 0, ZSTR_VAL(Z_STR_P(error_msg))); + if (res->body) { +- zend_update_property_string(stomp_ce_exception, &excobj, "details", sizeof("details")-1, (char *) res->body ); ++ zend_update_property_string(stomp_ce_exception, OBJ_FOR_PROP(&excobj), "details", sizeof("details")-1, (char *) res->body ); + } + } + stomp_free_frame(res); +@@ -733,17 +739,17 @@ PHP_FUNCTION(stomp_send) + frame.body_length = Z_STRLEN_P(msg); + } else if (Z_TYPE_P(msg) == IS_OBJECT && instanceof_function(Z_OBJCE_P(msg), stomp_ce_frame )) { + zval *frame_obj_prop = NULL; +- frame_obj_prop = zend_read_property(stomp_ce_frame, msg, "command", sizeof("command")-1, 1, &rv); ++ frame_obj_prop = zend_read_property(stomp_ce_frame, OBJ_FOR_PROP(msg), "command", sizeof("command")-1, 1, &rv); + if (Z_TYPE_P(frame_obj_prop) == IS_STRING) { + frame.command = Z_STRVAL_P(frame_obj_prop); + frame.command_length = Z_STRLEN_P(frame_obj_prop); + } +- frame_obj_prop = zend_read_property(stomp_ce_frame, msg, "body", sizeof("body")-1, 1, &rv); ++ frame_obj_prop = zend_read_property(stomp_ce_frame, OBJ_FOR_PROP(msg), "body", sizeof("body")-1, 1, &rv); + if (Z_TYPE_P(frame_obj_prop) == IS_STRING) { + frame.body = Z_STRVAL_P(frame_obj_prop); + frame.body_length = Z_STRLEN_P(frame_obj_prop); + } +- frame_obj_prop = zend_read_property(stomp_ce_frame, msg, "headers", sizeof("headers")-1, 1, &rv); ++ frame_obj_prop = zend_read_property(stomp_ce_frame, OBJ_FOR_PROP(msg), "headers", sizeof("headers")-1, 1, &rv); + if (Z_TYPE_P(frame_obj_prop) == IS_ARRAY) { + FRAME_HEADER_FROM_HASHTABLE(frame.headers, Z_ARRVAL_P(frame_obj_prop)); + } +@@ -928,7 +934,7 @@ PHP_FUNCTION(stomp_read_frame) + zval excobj; + THROW_STOMP_EXCEPTION(&excobj, 0, Z_STRVAL_P(error_msg)); + if (res->body) { +- zend_update_property_string(stomp_ce_exception, &excobj, ZEND_STRL("details"), (char *)res->body ); ++ zend_update_property_string(stomp_ce_exception, OBJ_FOR_PROP(&excobj), ZEND_STRL("details"), (char *)res->body ); + } + stomp_free_frame(res); + RETURN_FALSE; +@@ -966,10 +972,11 @@ PHP_FUNCTION(stomp_read_frame) + ZVAL_NULL(&body); + } + ++ memset(&fci, 0, sizeof(fci)); ++ memset(&fcc, 0, sizeof(fcc)); + fci.size = sizeof(fci); + #if (PHP_MAJOR_VERSION == 7 && PHP_MINOR_VERSION == 0) + fci.function_table = &ce->function_table; +- fci.symbol_table = NULL; + #endif + /* PARAMS */ + fci.param_count = 3; +@@ -981,8 +988,9 @@ PHP_FUNCTION(stomp_read_frame) + ZVAL_UNDEF(&fci.function_name); + fci.object = Z_OBJ_P(return_value); + fci.retval = &retval; ++#if PHP_VERSION_ID < 80000 + fci.no_separation = 1; +- ++#endif + #if PHP_VERSION_ID < 70300 + fcc.initialized = 1; + #endif +@@ -995,7 +1003,7 @@ PHP_FUNCTION(stomp_read_frame) + fcc.object = Z_OBJ_P(return_value); + + if (zend_call_function(&fci, &fcc ) == FAILURE) { +- zend_throw_exception_ex(zend_exception_get_default(TSRMLS_C), 0 , "Could not execute %s::%s()", ZSTR_VAL(ce->name), ZSTR_VAL(ce->constructor->common.function_name)); ++ zend_throw_exception_ex(zend_exception_get_default(), 0 , "Could not execute %s::%s()", ZSTR_VAL(ce->name), ZSTR_VAL(ce->constructor->common.function_name)); + } else { + zval_ptr_dtor(&retval); + } +@@ -1125,7 +1133,7 @@ static void _php_stomp_acknowledgment(INTERNAL_FUNCTION_PARAMETERS, char *cmd) { + } else if (Z_TYPE_P(msg) == IS_OBJECT && instanceof_function(Z_OBJCE_P(msg), stomp_ce_frame )) { + zval *frame_obj_prop, rv; + +- frame_obj_prop = zend_read_property(stomp_ce_frame, msg, "headers", sizeof("headers")-1, 1, &rv); ++ frame_obj_prop = zend_read_property(stomp_ce_frame, OBJ_FOR_PROP(msg), "headers", sizeof("headers")-1, 1, &rv); + if (Z_TYPE_P(frame_obj_prop) == IS_ARRAY) { + FRAME_HEADER_FROM_HASHTABLE(frame.headers, Z_ARRVAL_P(frame_obj_prop)); + } +@@ -1255,13 +1263,13 @@ PHP_METHOD(stompframe, __construct) + } + + if (command_length > 0) { +- zend_update_property_stringl(stomp_ce_frame, object, "command", sizeof("command")-1, command, command_length ); ++ zend_update_property_stringl(stomp_ce_frame, OBJ_FOR_PROP(object), "command", sizeof("command")-1, command, command_length ); + } + if (headers) { +- zend_update_property(stomp_ce_frame, object, "headers", sizeof("headers")-1, headers ); ++ zend_update_property(stomp_ce_frame, OBJ_FOR_PROP(object), "headers", sizeof("headers")-1, headers ); + } + if (body_length > 0) { +- zend_update_property_stringl(stomp_ce_frame, object, "body", sizeof("body")-1, body, body_length ); ++ zend_update_property_stringl(stomp_ce_frame, OBJ_FOR_PROP(object), "body", sizeof("body")-1, body, body_length ); + } + } + /* }}} */ +@@ -1271,7 +1279,7 @@ PHP_METHOD(stompframe, __construct) + PHP_METHOD(stompexception, getDetails) + { + zval *object = getThis(); +- zval rv, *details = zend_read_property(stomp_ce_exception, object, "details", sizeof("details")-1, 1, &rv); ++ zval rv, *details = zend_read_property(stomp_ce_exception, OBJ_FOR_PROP(object), "details", sizeof("details")-1, 1, &rv); + RETURN_STR(zval_get_string(details)); + } + /* }}} */ +diff --git a/stomp.c b/stomp.c +index d83a4e6..6e77ede 100644 +--- a/stomp.c ++++ b/stomp.c +@@ -34,7 +34,7 @@ extern zend_class_entry *stomp_ce_exception; + + /* {{{ DEBUG */ + #if PHP_DEBUG +-static void print_stomp_frame(stomp_frame_t *frame TSRMLS_DC) { ++static void print_stomp_frame(stomp_frame_t *frame) { + php_printf("------ START FRAME ------\n"); + php_printf("%s\n", frame->command); + /* Headers */ +@@ -186,7 +186,7 @@ int stomp_writable(stomp_t *stomp) + + /* {{{ stomp_connect + */ +-int stomp_connect(stomp_t *stomp, const char *host, unsigned short port TSRMLS_DC) ++int stomp_connect(stomp_t *stomp, const char *host, unsigned short port) + { + char error[1024]; + socklen_t size; +@@ -297,7 +297,7 @@ void stomp_close(stomp_t *stomp) + + /* {{{ stomp_send + */ +-int stomp_send(stomp_t *stomp, stomp_frame_t *frame TSRMLS_DC) ++int stomp_send(stomp_t *stomp, stomp_frame_t *frame) + { + smart_str buf = {0}; + +diff --git a/stomp.h b/stomp.h +index 1a422b7..e4d02b3 100644 +--- a/stomp.h ++++ b/stomp.h +@@ -79,9 +79,9 @@ typedef struct _stomp { + } stomp_t; + + stomp_t *stomp_init(); +-int stomp_connect(stomp_t *stomp, const char *host, unsigned short port TSRMLS_DC); ++int stomp_connect(stomp_t *stomp, const char *host, unsigned short port); + void stomp_close(stomp_t *stomp); +-int stomp_send(stomp_t *connection, stomp_frame_t *frame TSRMLS_DC); ++int stomp_send(stomp_t *connection, stomp_frame_t *frame); + stomp_frame_t *stomp_read_frame_ex(stomp_t *connection, int use_stack); + int stomp_valid_receipt(stomp_t *connection, stomp_frame_t *frame); + int stomp_select_ex(stomp_t *connection, const long int sec, const long int usec); +diff --git a/tests/003-connect/003.phpt b/tests/003-connect/003.phpt +index b3de8d6..ba60e15 100644 +--- a/tests/003-connect/003.phpt ++++ b/tests/003-connect/003.phpt +@@ -2,7 +2,7 @@ + Test stomp_connect() - Test error on CONNECT + --SKIPIF-- + <?php +-include "../skipif.inc" ++include dirname(__DIR__) . "/skipif.inc"; + ?> + --FILE-- + <?php +diff --git a/tests/005-close/001.phpt b/tests/005-close/001.phpt +index 0a23a59..77cc014 100644 +--- a/tests/005-close/001.phpt ++++ b/tests/005-close/001.phpt +@@ -6,7 +6,11 @@ include dirname(__DIR__) . "/skipif.inc"; + ?> + --FILE-- + <?php +-stomp_close(null); ++try { ++ stomp_close(null); ++} catch (TypeError $e) { ++ echo $e->getMessage() . PHP_EOL; ++} + ?> + --EXPECTF-- +-Warning: stomp_close() expects parameter 1 to be resource, null given in %s on line %d ++%stomp_close()%s1%s null %s +diff --git a/tests/007-subscribe/001.phpt b/tests/007-subscribe/001.phpt +index 8d190dd..494471c 100644 +--- a/tests/007-subscribe/001.phpt ++++ b/tests/007-subscribe/001.phpt +@@ -16,7 +16,7 @@ $s->subscribe('/queue/test', 'string'); + --EXPECTF-- + Warning: Stomp::subscribe(): Destination can not be empty in %s007-subscribe%c001.php on line %d + +-Fatal error: Uncaught TypeError: Argument 2 passed to Stomp::subscribe() must be of the type array, string given in %s007-subscribe%c001.php:%d ++Fatal error: Uncaught TypeError: %s, string given in %s007-subscribe%c001.php:%d + Stack trace: + #0 %s001.php(%d): Stomp->subscribe('/queue/test', 'string') + #1 {main} +diff --git a/tests/008-unsubscribe/001.phpt b/tests/008-unsubscribe/001.phpt +index c1200eb..7d1b50f 100644 +--- a/tests/008-unsubscribe/001.phpt ++++ b/tests/008-unsubscribe/001.phpt +@@ -17,7 +17,7 @@ $s->unsubscribe('/queue/test', 'string'); + --EXPECTF-- + Warning: Stomp::unsubscribe(): Destination can not be empty in %s008-unsubscribe%c001.php on line %d + +-Fatal error: Uncaught TypeError: Argument 2 passed to Stomp::unsubscribe() must be of the type array, string given in %s008-unsubscribe%c001.php:%d ++Fatal error: Uncaught TypeError: %s2%s string given in %s008-unsubscribe%c001.php:%d + Stack trace: + #0 %s(%d): Stomp->unsubscribe('/queue/test', 'string') + #1 {main} +diff --git a/tests/010-timeout/001.phpt b/tests/010-timeout/001.phpt +index 7389f70..b9886db 100644 +--- a/tests/010-timeout/001.phpt ++++ b/tests/010-timeout/001.phpt +@@ -25,13 +25,21 @@ var_dump($s->setReadTimeout(10, 5)); + // Third test, read supposed to return 10.5 + var_dump($s->getReadTimeout()); + +-// Set read timout with the first param as a string, supposed to trigger a warning +-var_dump($s->setReadTimeout('')); ++try { ++ // Set read timout with the first param as a string, supposed to trigger a warning/exception ++ var_dump($s->setReadTimeout('')); ++} catch (TypeError $e) { ++ echo $e->getMessage() . PHP_EOL; ++} + // Fourth test, read supposed to get the last value set : 10.5 + var_dump($s->getReadTimeout()); + +-// Set read timout with the second param as a string, supposed to trigger a warning +-var_dump($s->setReadTimeout(10, '')); ++try { ++ // Set read timout with the second param as a string, supposed to trigger a warning/exception ++ var_dump($s->setReadTimeout(10, '')); ++} catch (TypeError $e) { ++ echo $e->getMessage() . PHP_EOL; ++} + // Fourth test, read supposed to get the last value set : 10.5 + var_dump($s->getReadTimeout()); + +@@ -64,18 +72,14 @@ array(2) { + ["usec"]=> + int(5) + } +- +-Warning: Stomp::setReadTimeout() expects parameter 1 to be long, string given in %s on line %d +-NULL ++%AStomp::setReadTimeout()%s1%s string given%A + array(2) { + ["sec"]=> + int(10) + ["usec"]=> + int(5) + } +- +-Warning: Stomp::setReadTimeout() expects parameter 2 to be long, string given in %s on line %d +-NULL ++%AStomp::setReadTimeout()%s2%s string given%A + array(2) { + ["sec"]=> + int(10) +diff --git a/tests/010-timeout/002.phpt b/tests/010-timeout/002.phpt +index a6a9b4a..c22dedf 100644 +--- a/tests/010-timeout/002.phpt ++++ b/tests/010-timeout/002.phpt +@@ -25,13 +25,23 @@ var_dump(stomp_set_read_timeout($link, 10, 5)); + // Third test, read supposed to return 10.5 + var_dump(stomp_get_read_timeout($link)); + +-// Set read timout with the first param as a string, supposed to trigger a warning +-var_dump(stomp_set_read_timeout($link, '')); ++try { ++ // Set read timout with the first param as a string, supposed to trigger a warning on PHP 7 ++ // supposed to trigger an exception on PHP 8 ++ var_dump(stomp_set_read_timeout($link, '')); ++} catch (TypeError $e) { ++ echo $e->getMessage() . PHP_EOL; ++} + // Fourth test, read supposed to get the last value set : 10.5 + var_dump(stomp_get_read_timeout($link)); + +-// Set read timout with the second param as a string, supposed to trigger a warning +-var_dump(stomp_set_read_timeout($link, 10, '')); ++try { ++ // Set read timout with the second param as a string, supposed to trigger a warning on PHP 7 ++ // supposed to trigger an exception on PHP 8 ++ var_dump(stomp_set_read_timeout($link, 10, '')); ++} catch (TypeError $e) { ++ echo $e->getMessage() . PHP_EOL; ++} + // Fourth test, read supposed to get the last value set : 10.5 + var_dump(stomp_get_read_timeout($link)); + +@@ -64,18 +74,14 @@ array(2) { + ["usec"]=> + int(5) + } +- +-Warning: stomp_set_read_timeout() expects parameter 2 to be long, string given in %s on line %d +-NULL ++%Astomp_set_read_timeout()%s2%S string given%A + array(2) { + ["sec"]=> + int(10) + ["usec"]=> + int(5) + } +- +-Warning: stomp_set_read_timeout() expects parameter 3 to be long, string given in %s on line %d +-NULL ++%Astomp_set_read_timeout()%s3%s string given%A + array(2) { + ["sec"]=> + int(10) + |