Parse errors are caught by the error handler in PHP7, but they may not be of the type Exception
Remove type-hinting so that we can catch them and deal with them
Details
- Reviewers
epriestley - Group Reviewers
Blessed Reviewers - Maniphest Tasks
- T9640: Make Phabricator compatible with PHP7
T9637: Unable to execute arc unit --everything on PHP7 - Commits
- rPHUd5b4421792e5: Remove Exception typehint to fix T9637
arc unit --everything
Diff Detail
- Repository
- rPHU libphutil
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
I think this is generally correct, but that handleException() should be pretty much unchanged. We should introduce a new handleThrowable() instead, probably, and set_exception_handler() to handleThrowable(), then have that pass the exception to handleException if it is really an Exception.
If it isn't, we should do "something else", but I don't know exactly what that something else is.
Well, maybe this approach is fine, since Throwable seems to pretty much be exactly equivalent to Exception except that the equivalence is done in a PHP way so it's a huge mess.
But we should probably rename all of these from Exception -> Throwable to make it clear, I guess?
Would we handle anything differently? I don't think so, instead of fatals showing a white page with and some ascii art as we do now, it will show fatals like we show exceptions, unless we want to show the white page with the ascii art for fatals?
Probably, I wasn't sure if these methods were used elsewhere and I would have to grep the codebases in everything
Yeah, my thinking was that we might end up calling some stuff that calls some other stuff that ends up breaking things, but that's dangerous to do on this pathway anyway.
Let's just do this change as-is, I guess, except put some sort of more meaningful TODO comment on the unit test thing? Like "this was valid as part of the syntax until PHP 7 even though it did not make sense, but is no longer parsed".
Thanks! You should have commit access now.
src/parser/xhpast/api/__tests__/XHPASTTreeTestCase.php | ||
---|---|---|
50–51 | Oh, we just pick up TODO: literally, not @todo. |