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
F15523737: D9239.diff
Mon, Apr 21, 3:21 AM
F15489885: D9239.id21945.diff
Fri, Apr 11, 1:09 PM
F15489113: D9239.id21944.diff
Fri, Apr 11, 6:08 AM
F15488606: D9239.id21953.diff
Thu, Apr 10, 11:58 PM
F15478564: D9239.diff
Tue, Apr 8, 1:08 AM
F15470213: D9239.id21945.diff
Fri, Apr 4, 9:17 PM
F15454392: D9239.id21945.diff
Sat, Mar 29, 6:21 PM
F15451654: D9239.id21953.diff
Fri, Mar 28, 11:11 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
Lint
Lint Skipped
Unit
Tests Skipped

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).