Skip to content

Commit a0a74b0

Browse files
authored
Fix undefined method call: replace body() with getBody() in rpc_client.php
Replaced the incorrect call to AMQPMessage::body() with the correct method AMQPMessage::getBody() in rpc_client.php. The 'body()' method does not exist in PhpAmqpLib\Message\AMQPMessage, leading to a fatal error at runtime. According to the PhpAmqpLib documentation, 'getBody()' should be used to retrieve the message content. This change ensures compatibility with the current version of php-amqplib/php-amqplib and prevents runtime errors during RPC calls.
1 parent 1bbfe81 commit a0a74b0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tutorials/tutorial-six-php.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ class FibonacciRpcClient
296296
public function onResponse(AMQPMessage $rep)
297297
{
298298
if ($rep->get('correlation_id') === $this->corr_id) {
299-
$this->response = $rep->body();
299+
$this->response = $rep->getBody();
300300
}
301301
}
302302

0 commit comments

Comments
 (0)