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
F13281915: D9239.diff
Sun, Jun 2, 11:26 AM
F13211512: D9239.diff
Fri, May 17, 5:50 AM
F13194534: D9239.diff
Sun, May 12, 9:38 PM
F13177983: D9239.diff
Wed, May 8, 8:05 PM
Unknown Object (File)
May 2 2024, 6:38 AM
Unknown Object (File)
Apr 24 2024, 10:47 PM
Unknown Object (File)
Apr 23 2024, 4:51 AM
Unknown Object (File)
Apr 12 2024, 1:45 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).