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
Unknown Object (File)
Mon, Feb 17, 3:15 PM
Unknown Object (File)
Sun, Feb 16, 4:36 AM
Unknown Object (File)
Thu, Feb 13, 1:34 AM
Unknown Object (File)
Thu, Feb 13, 1:34 AM
Unknown Object (File)
Sun, Feb 9, 6:01 PM
Unknown Object (File)
Sun, Feb 9, 1:07 PM
Unknown Object (File)
Sun, Feb 9, 1:07 PM
Unknown Object (File)
Sun, Feb 9, 1:07 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 632
Build 632: [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).