Skip to content

Laravel 5.4 compatibility #46

@KKSzymanowski

Description

@KKSzymanowski

Laravel 5.4 will probably be released this or next month and there is a compatibility issue which will have to be addressed.

There has been some changes to Illuminate\Events\Dispatcher, eg. in this commit. It no longer exposes the firing() method used in SentryLaravelEventHandler. From what I understand it is used to retrieve the name of the current event and direct the control flow accordingly.
In 5.4, when an wildcard event listener has been registered, the listener method will be called with two arguments:

  • Event name
  • Event payload

That said, following changes will be required in SentryLaravelEventHandler::onWildcardEvent.

  1. Add previously mentioned arguments:
public function onWildcardEvent($eventName, $payload)
  1. Instead of $args = func_get_args(); we can use the second argument which is the event payload. Eg.
$route = $args[0]->route;

will have to be replaced with

$route = $payload[0]->route;

While we're on the subject of the onWildcardEvent method it feels a bit messy for me. I refactored it here, tell me what do you think.

Also, event names have changed. Eg. Laravel no longer raises illuminate.log event, instead an instance of Illuminate\Log\Events\MessageLogged is sent. You can see more in this commit. I reflected these changes in the Gist.

For now it's all I have discovered in this subject. Tell me if you're interested in a Pull Request regarding these changes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions