Skip to content

Instantly share code, notes, and snippets.

@jaytaph
Created September 27, 2011 20:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaytaph/1246073 to your computer and use it in GitHub Desktop.
Save jaytaph/1246073 to your computer and use it in GitHub Desktop.
Binary body Patch bug pecl #24381
Index: stomp.c
===================================================================
--- stomp.c (revision 317407)
+++ stomp.c (working copy)
@@ -473,7 +473,7 @@
while (1) {
char *p = NULL;
length = stomp_read_line(stomp, &p);
-
+
if (length < 0) {
RETURN_READ_FRAME_FAIL;
}
@@ -506,7 +506,7 @@
}
/* Check for the content length */
- if (zend_hash_find(f->headers, "content-length", strlen("content-length"), (void **)&length_str) == SUCCESS) {
+ if (zend_hash_find(f->headers, "content-length", strlen("content-length") + 1, (void **)&length_str) == SUCCESS) {
char endbuffer[2];
length = 2;
@@ -534,13 +534,13 @@
int success = 1;
char error[1024];
char *receipt = NULL;
- if (zend_hash_find(frame->headers, "receipt", sizeof("receipt"), (void **)&receipt) == SUCCESS) {
+ if (zend_hash_find(frame->headers, "receipt", sizeof("receipt") + 1, (void **)&receipt) == SUCCESS) {
stomp_frame_t *res = stomp_read_frame(stomp);
success = 0;
if (res) {
if (0 == strncmp("RECEIPT", res->command, sizeof("RECEIPT") - 1)) {
char *receipt_id = NULL;
- if (zend_hash_find(res->headers, "receipt-id", sizeof("receipt-id"), (void **)&receipt_id) == SUCCESS
+ if (zend_hash_find(res->headers, "receipt-id", sizeof("receipt-id") + 1, (void **)&receipt_id) == SUCCESS
&& strlen(receipt) == strlen(receipt_id)
&& !strcmp(receipt, receipt_id)) {
success = 1;
@@ -550,7 +550,7 @@
}
} else if (0 == strncmp("ERROR", res->command, sizeof("ERROR") - 1)) {
char *error_msg = NULL;
- if (zend_hash_find(res->headers, "message", sizeof("message"), (void **)&error_msg) == SUCCESS) {
+ if (zend_hash_find(res->headers, "message", sizeof("message") + 1, (void **)&error_msg) == SUCCESS) {
stomp_set_error(stomp, error_msg, 0, res->body);
}
} else {
Index: php_stomp.c
===================================================================
--- php_stomp.c (revision 317407)
+++ php_stomp.c (working copy)
@@ -990,7 +990,7 @@
array_init(return_value);
add_assoc_string_ex(return_value, "command", sizeof("command"), res->command, 1);
if (res->body) {
- add_assoc_string_ex(return_value, "body", sizeof("body"), res->body, 1);
+ add_assoc_stringl_ex(return_value, "body", sizeof("body"), res->body, res->body_length, 1);
}
add_assoc_zval_ex(return_value, "headers", sizeof("headers"), headers);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment