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, Nov 25, 1:47 AM
Unknown Object (File)
Fri, Nov 22, 4:49 PM
Unknown Object (File)
Thu, Nov 21, 7:55 AM
Unknown Object (File)
Wed, Nov 20, 6:28 PM
Unknown Object (File)
Sun, Nov 17, 12:54 AM
Unknown Object (File)
Thu, Nov 14, 5:20 AM
Unknown Object (File)
Thu, Nov 14, 5:15 AM
Unknown Object (File)
Fri, Nov 8, 11:42 AM

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