Page MenuHomePhabricator

Fix XHPAST to detect use of undeclared variables in `catch`
ClosedPublic

Authored by epriestley on May 21 2014, 5:55 PM.
Tags
None
Referenced Files
F17943892: D9239.id.diff
Jul 31 2025, 9:02 AM
F17884642: D9239.diff
Jul 29 2025, 12:03 AM
Unknown Object (File)
May 4 2025, 11:10 AM
Unknown Object (File)
May 4 2025, 5:02 AM
Unknown Object (File)
May 4 2025, 5:02 AM
Unknown Object (File)
Apr 23 2025, 1:19 PM
Unknown Object (File)
Apr 21 2025, 3:21 AM
Unknown Object (File)
Apr 11 2025, 1:09 PM

Details

Summary

Currently, when code has a block like:

} catch (Exception $ex) {

...we attempt to mark "$ex" as declared. However, we incorrectly mark every variable used anywhere in the block as declared. This means we'll never raise this warning in a catch block.

Instead only mark the caught exception as declared.

Test Plan

Added a failing unit test and made it pass.

Diff Detail

Repository
rARC Arcanist
Branch
cblock
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 631
Build 631: [Placeholder Plan] Wait for 30 Seconds

Event Timeline

epriestley retitled this revision from to Fix XHPAST to detect use of undeclared variables in `catch`.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added reviewers: btrahan, joshuaspence.
epriestley added a subscriber: lpriestley.
  • Add a newline to the end of that file.
btrahan edited edge metadata.
This revision is now accepted and ready to land.May 21 2014, 6:36 PM
epriestley updated this revision to Diff 21953.

Closed by commit rARCc999f3e6b5c7 (authored by @epriestley).