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

Invalid error info in error_get_last on fatal errors #3950

Closed
Majkl578 opened this Issue Oct 10, 2014 · 3 comments

Comments

Projects
None yet
4 participants
@Majkl578
Contributor

Majkl578 commented Oct 10, 2014

We use similar pattern in order to handle fatal errors:

register_shutdown_function(function () {
    $error = error_get_last();
    if (in_array($error['type'], array(E_ERROR, E_CORE_ERROR, E_COMPILE_ERROR, E_PARSE, E_RECOVERABLE_ERROR, E_USER_ERROR), TRUE)) {
        // somehow handle this error, e.g.:
        echo 'Error occurred. :(';
    }
});

invalidFunction();

It works fine with PHP, but not with HHVM, the code differs. Also file and line are not populated correctly. http://3v4l.org/Uvste

@Majkl578

This comment has been minimized.

Show comment
Hide comment
@Majkl578

Majkl578 Oct 22, 2014

Contributor

This behavior is very important for us and breaks a widely used debugging library.
It looks like it is broken intentionally though, probably in https://github.com/facebook/hhvm/blob/78e5a3a36f1fc48176cf21d419589ee3686cb005/hphp/runtime/base/runtime-error.h#L57-69.
What would be the suggested fix for this? The code SHOULD stay same as in PHP without any doubts, on the other hand, extra "hiphop" bit might be useful too.

Contributor

Majkl578 commented Oct 22, 2014

This behavior is very important for us and breaks a widely used debugging library.
It looks like it is broken intentionally though, probably in https://github.com/facebook/hhvm/blob/78e5a3a36f1fc48176cf21d419589ee3686cb005/hphp/runtime/base/runtime-error.h#L57-69.
What would be the suggested fix for this? The code SHOULD stay same as in PHP without any doubts, on the other hand, extra "hiphop" bit might be useful too.

@nokitakaze

This comment has been minimized.

Show comment
Hide comment
@nokitakaze

nokitakaze Nov 4, 2014

You may use this method http://3v4l.org/YVKcp to get real line number but not for real type.

nokitakaze commented Nov 4, 2014

You may use this method http://3v4l.org/YVKcp to get real line number but not for real type.

@Orvid

This comment has been minimized.

Show comment
Hide comment
@Orvid

Orvid Apr 29, 2016

Contributor

This appears to be fixed in the current HHVM.

Contributor

Orvid commented Apr 29, 2016

This appears to be fixed in the current HHVM.

@Orvid Orvid closed this Apr 29, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment