The exception handler _js_exception_handler() expects an argument of type Exception, but in php 7 most exceptions thrown are of type Error, so if an exception is thrown during the js callback, it attempts to be handled by this function, but then throws an error like Argument 1 must be an instance of Exception, instance of Error given.

In PHP 7, both Exception and Error extend Throwable, so the type hint could be changed to that, but I believe that wouldn't be compatible with pre-7. The type hint could also be removed.

See http://php.net/manual/en/function.set-exception-handler.php

Comments

goron created an issue. See original summary.

goron’s picture

Issue summary: View changes
scottatdrake’s picture

StatusFileSize
new614 bytes

I ran into this issue as well. Attaching a patch that removes the type hint.

alex.bukach’s picture

Status: Active » Reviewed & tested by the community

Works fine for me!

markhalliwell’s picture

Status: Reviewed & tested by the community » Fixed
StatusFileSize
new2.23 KB

Thanks for the patch! I actually went ahead and added proper support for this so it will actually catch both as well.

  • markcarver committed e530417 on 7.x-2.x
    Issue #3027913 by markcarver, scottatdrake, goron, Alex Bukach: Error in...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.