From 618d2bd4d4eed99d17d9271788eaa90d838bd9ca Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Tue, 18 Aug 2015 12:07:50 +0300 Subject: [PATCH 1/2] Fix compiler warning (assignment makes pointer from integer without a cast) --- php_stomp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/php_stomp.c b/php_stomp.c index 81bf8e9..9012059 100644 --- a/php_stomp.c +++ b/php_stomp.c @@ -531,6 +531,7 @@ PHP_FUNCTION(stomp_connect) if (stomp->status) { stomp_frame_t *res; + int rres; stomp_frame_t frame = {0}; INIT_FRAME(frame, "CONNECT"); @@ -549,9 +550,9 @@ PHP_FUNCTION(stomp_connect) FRAME_HEADER_FROM_HASHTABLE(frame.headers, Z_ARRVAL_P(headers)); } - res = stomp_send(stomp, &frame TSRMLS_CC); + rres = stomp_send(stomp, &frame TSRMLS_CC); CLEAR_FRAME(frame); - if (0 == res) { + if (0 == rres) { zval *excobj = zend_throw_exception_ex(stomp_ce_exception, stomp->errnum TSRMLS_CC, stomp->error); if (stomp->error_details) { zend_update_property_string(stomp_ce_exception, excobj, "details", sizeof("details")-1, stomp->error_details TSRMLS_CC); From acf43f619f177eb2370d24f84319a66c4a1a3cc6 Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Tue, 18 Aug 2015 12:08:09 +0300 Subject: [PATCH 2/2] Only add content-length header for messages containing zero byte Allows OpenMQ/ActiveMQ to correctly map messages to JMS TextMessages instead of only BytesMessages. Fixes https://bugs.php.net/bug.php?id=70280 --- php_stomp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/php_stomp.c b/php_stomp.c index 9012059..0536b76 100644 --- a/php_stomp.c +++ b/php_stomp.c @@ -747,6 +747,8 @@ PHP_FUNCTION(stomp_send) CLEAR_FRAME(frame); RETURN_FALSE; } + if (frame.body_length > 0 && strnlen(frame.body, frame.body_length) >= frame.body_length) + frame.body_length = 0; if (stomp_send(stomp, &frame TSRMLS_CC) > 0) { success = stomp_valid_receipt(stomp, &frame);