HomePhabricator

Fix XHPAST to detect use of undeclared variables in `catch`

Description

Fix XHPAST to detect use of undeclared variables in catch

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.

Reviewers: joshuaspence, btrahan

Reviewed By: btrahan

Subscribers: lpriestley, epriestley

Differential Revision: https://secure.phabricator.com/D9239

Details

Provenance
epriestleyAuthored on
epriestleyPushed on May 21 2014, 7:23 PM
Reviewer
btrahan
Differential Revision
D9239: Fix XHPAST to detect use of undeclared variables in `catch`
Parents
rARC8274ffa44dec: Update PHP compatibility information.
Branches
Unknown
Tags
Unknown

Event Timeline