mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 14:00:56 +01:00
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
This commit is contained in:
parent
7b0c608df8
commit
fd87a88d71
1 changed files with 10 additions and 0 deletions
|
@ -1695,6 +1695,16 @@ abstract class LiskDAO {
|
||||||
*/
|
*/
|
||||||
public function __call($method, $args) {
|
public function __call($method, $args) {
|
||||||
|
|
||||||
|
// NOTE: PHP has a bug that static variables defined in __call() are shared
|
||||||
|
// across all children classes. Call a different method to work around this
|
||||||
|
// bug.
|
||||||
|
return $this->call($method, $args);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @task util
|
||||||
|
*/
|
||||||
|
final protected function call($method, $args) {
|
||||||
// NOTE: This method is very performance-sensitive (many thousands of calls
|
// NOTE: This method is very performance-sensitive (many thousands of calls
|
||||||
// per page on some pages), and thus has some silliness in the name of
|
// per page on some pages), and thus has some silliness in the name of
|
||||||
// optimizations.
|
// optimizations.
|
||||||
|
|
Loading…
Reference in a new issue