@@ -197,9 +197,13 @@ NR_PHP_WRAPPER(nr_rabbitmq_basic_publish) {
197
197
message_params .destination_name
198
198
= ENSURE_PERSISTENCE (Z_STRVAL_P (amqp_exchange ));
199
199
} else {
200
- /* For producer, this is exchange name. Exchange name is Default in case of
201
- * empty string. */
202
- message_params .destination_name = ENSURE_PERSISTENCE ("Default" );
200
+ /*
201
+ * For producer, this is exchange name. Exchange name is Default in case of
202
+ * empty string.
203
+ */
204
+ if (nr_php_is_zval_valid_string (amqp_exchange )) {
205
+ message_params .destination_name = ENSURE_PERSISTENCE ("Default" );
206
+ }
203
207
}
204
208
205
209
amqp_routing_key = nr_php_get_user_func_arg (3 , NR_EXECUTE_ORIG_ARGS );
@@ -327,12 +331,18 @@ NR_PHP_WRAPPER(nr_rabbitmq_basic_get) {
327
331
*/
328
332
amqp_exchange = nr_php_get_zval_object_property (* retval_ptr , "exchange" );
329
333
if (nr_php_is_zval_non_empty_string (amqp_exchange )) {
330
- /* Used with consumer only; his is exchange name. Exchange name is
334
+ /* Used with consumer only; this is exchange name. Exchange name is
331
335
* Default in case of empty string. */
332
336
message_params .messaging_destination_publish_name
333
337
= Z_STRVAL_P (amqp_exchange );
334
338
} else {
335
- message_params .messaging_destination_publish_name = "Default" ;
339
+ /*
340
+ * For consumer, this is exchange name. Exchange name is Default in case
341
+ * of empty string.
342
+ */
343
+ if (nr_php_is_zval_valid_string (amqp_exchange )) {
344
+ message_params .messaging_destination_publish_name = "Default" ;
345
+ }
336
346
}
337
347
338
348
amqp_routing_key
@@ -373,7 +383,6 @@ NR_PHP_WRAPPER(nr_rabbitmq_basic_get) {
373
383
UNDO_PERSISTENCE (message_params .destination_name );
374
384
}
375
385
NR_PHP_WRAPPER_END
376
-
377
386
void nr_php_amqplib_enable () {
378
387
/*
379
388
* Set the UNKNOWN package first, so it doesn't overwrite what we find with
0 commit comments