Page MenuHomePhabricator

Improve PHP7 error reporting for include-time syntax errors
ClosedPublic

Authored by epriestley on Nov 28 2017, 2:05 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Apr 8, 7:07 PM
Unknown Object (File)
Sun, Apr 7, 3:34 AM
Unknown Object (File)
Thu, Mar 28, 10:24 PM
Unknown Object (File)
Mar 17 2024, 8:19 AM
Unknown Object (File)
Mar 16 2024, 2:50 AM
Unknown Object (File)
Mar 8 2024, 5:25 PM
Unknown Object (File)
Mar 1 2024, 3:28 AM
Unknown Object (File)
Feb 28 2024, 3:46 PM
Subscribers
None

Details

Summary

Ref T12101. Ref T12855. Ref T12190.

In PHP7, include_once may raise a Throwable which has a useless message and stack trace (neither point at the actual file or line where the error occurs).

Catch and mangle these so they're useful. This upgrades the message from syntax error: unexpected X so it has a file and line number.

Test Plan

Screen Shot 2017-11-28 at 6.03.12 AM.png (1×1 px, 220 KB)

Diff Detail

Repository
rPHU libphutil
Branch
throw1
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 18872
Build 25446: Run Core Tests
Build 25445: arc lint + arc unit

Event Timeline

This revision is now accepted and ready to land.Nov 28 2017, 5:54 PM

The specific error / reproduction case here was something like $this->someMethod(): (instead of ...();) if that's helpful to some future archaeologist.

This revision was automatically updated to reflect the committed changes.