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
F15409378: D9239.id21945.diff
Wed, Mar 19, 4:27 AM
F15397060: D9239.id21944.diff
Sun, Mar 16, 5:53 PM
F15377158: D9239.id21945.diff
Thu, Mar 13, 8:19 AM
F15345117: D9239.id21944.diff
Mon, Mar 10, 8:37 AM
F15331934: D9239.id21945.diff
Fri, Mar 7, 3:31 PM
Unknown Object (File)
Fri, Feb 21, 11:35 AM
Unknown Object (File)
Feb 17 2025, 3:15 PM
Unknown Object (File)
Feb 16 2025, 4:36 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
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).