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
F18932905: D18797.diff
Mon, Nov 10, 9:43 AM
F18861774: D18797.diff
Sun, Nov 2, 4:32 PM
F18770775: D18797.id.diff
Oct 8 2025, 2:45 PM
F18770349: D18797.id.diff
Oct 8 2025, 12:06 PM
F18765123: D18797.diff
Oct 7 2025, 9:38 AM
F18702503: D18797.id45091.diff
Sep 28 2025, 12:21 AM
F18645756: D18797.id.diff
Sep 19 2025, 8:28 AM
F18627770: D18797.diff
Sep 16 2025, 4:44 AM
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
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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.