Homec4science

Fix static variable usage in Lisk

Authored by vrana <jakubv@fb.com> on Oct 20 2012, 02:43.

Description

Fix static variable usage in Lisk

Summary:
See comment.
This can reveal some pretty bad bugs but HPHP handles this correctly so we already know about them.

Test Plan:
Added phlog() to __call() and observed what is defined for each method (under PHP). Also:

class C {
  function __call($name, $args) {
    static $class;
    if (!$class) {
      $class = get_class($this);
    }
    return $class;
  }
}

class D extends C {
}

class E extends C {
}

$d = new D;
$e = new E;
var_dump($d->x());
var_dump($e->x()); // Prints D under PHP!

See also D3754.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T1261

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

Details

Committed
vrana <jakubv@fb.com>Oct 20 2012, 14:04
Pushed
aubortJan 31 2017, 17:16
Parents
rPH7b0c608df8f2: Fix symbol search in typeahead
Branches
Unknown
Tags
Unknown

Event Timeline

vrana <jakubv@fb.com> committed rPHfd87a88d710e: Fix static variable usage in Lisk (authored by vrana <jakubv@fb.com>).Oct 20 2012, 14:04