-
-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
There is a bug in payload transmission #33
Conversation
master of nuwber to me
Hi @igor875126 I'll be glad to get feedback from you if it works or not. |
Hey, thank you for your answer, unfortunately i cannot do this, because of microservice architecture and other libraries. I mean in the project where payload is beeing sent we are using another framework and another rabbit lib. Please check my merge request, I am almost 100% sure that this will work with even not surrounded payloads. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My project is working on rabbitevents and we're sending all our requests like fire('event.name', ['arg1', ['key' => 'value'], ... ])
. It wouldn't work if I apply this change.
Second thing is that tests are not passed. Please see my code comment.
@@ -59,7 +59,7 @@ public function __construct( | |||
*/ | |||
public function fire() | |||
{ | |||
return call_user_func($this->listener, $this->event, Arr::wrap($this->payload())); | |||
return call_user_func($this->listener, $this->event, Arr::wrap([$this->payload()])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- In this case, you don't need
Arr::wrap
- What if somebody passed data covered by
[]
? Already working applications must became broken.
@igor875126 is this PR still actual? |
No, it's not actual any more. You can close it. Unfortunately, we are forced to fork your repository and continue developing to our needs. |
Hey, I've found a behavior that when you use not an wildcard listener the payload is given as string in the listener handle method, this string is the first element of payload array.
But if you wrap it in the additional array, then everything is working as expected, wildcard listeners tested too....
Example:
BroadcastEventServiceProvider
UserAuthenticatedListener
Payload in rabbitmq message
dd($payload)
With my fix - dd($payload)
BTW: I am using PHP 7.3.9 + Laravel ^6.0
nuwber/rabbitevents 2.0 - same behavoir
nuwber/rabbitevents 3.0-beta1 - same behavoir