Export to GitHub

php-amqp - issue #6

Reverse logic in amqp_basic_publish()


Posted on Nov 25, 2009 by Happy Kangaroo

Expected return value from amqp_basic_publish() on success should be true. Instead, false is being returned.

Currently the code checks:

 if (_php_amqp_socket_error(rpc_result, "BasicPublish")) {
     RETURN_FALSE;
 }
 RETURN_TRUE;

But according to _php_amqp_socket_error(), it will return 0 and raise a WARNING on failure. This should either check if (!..), or reverse the RETURN_FALSE/RETURN_TRUE:

@@ -585,9 +587,9 @@ (amqp_bytes_t) {.len = body_len, .bytes = body});

 if (_php_amqp_socket_error(rpc_result, "BasicPublish")) {

- RETURN_FALSE; + RETURN_TRUE; } - RETURN_TRUE; + RETURN_FALSE; } /* }}} */

Comment #1

Posted on Feb 5, 2010 by Happy Kangaroo

This change is included in my patch attached to issues 4 and 5

Status: New

Labels:
Type-Defect Priority-Medium