Skip to content

Commit

Permalink
Default forward_static_call to a fatal
Browse files Browse the repository at this point in the history
Summary:
`forward_static_call` has it's defaults set to a warning here: [D13424056].

This defaults `forward_static_call` to a fatal.

Tests that were explicitly testing the behaviour of `forward_static_call` and `forward_static_call_array` have been removed. While other tests that used them have been updated.

Reviewed By: ricklavoie

Differential Revision: D13938319

fbshipit-source-id: bd89af64b4f4109b02288fb69892ff548711478f
  • Loading branch information
MaggieMoss authored and hhvm-bot committed Feb 6, 2019
1 parent ced94d7 commit 55342a0
Show file tree
Hide file tree
Showing 24 changed files with 119 additions and 2,169 deletions.
4 changes: 2 additions & 2 deletions hphp/runtime/base/runtime-option.cpp
Expand Up @@ -696,8 +696,8 @@ int64_t RuntimeOption::HeapLowWaterMark = 16;
int64_t RuntimeOption::HeapHighWaterMark = 1024;

uint64_t RuntimeOption::DisableExtract = 0;
uint64_t RuntimeOption::DisableForwardStaticCall = 1;
uint64_t RuntimeOption::DisableForwardStaticCallArray = 1;
uint64_t RuntimeOption::DisableForwardStaticCall = 2;
uint64_t RuntimeOption::DisableForwardStaticCallArray = 2;
uint64_t RuntimeOption::DisableCallUserFunc = 0;
uint64_t RuntimeOption::DisableCallUserFuncArray = 0;
uint64_t RuntimeOption::DisableParseStrSingleArg = 0;
Expand Down
41 changes: 0 additions & 41 deletions hphp/test/quick/fsc01.php

This file was deleted.

29 changes: 0 additions & 29 deletions hphp/test/quick/fsc01.php.expectf

This file was deleted.

1 change: 0 additions & 1 deletion hphp/test/quick/fsc02.php
Expand Up @@ -13,7 +13,6 @@ public function f1() {
class C extends B {
public function g() {
$obj = new B;
forward_static_call(array('B', 'f1'));
call_user_func(array('B', 'f1'));
}
}
Expand Down
5 changes: 0 additions & 5 deletions hphp/test/quick/fsc02.php.expectf
@@ -1,7 +1,2 @@
Warning: forward_static_call() is deprecated and subject to removal from the Hack language in %s on line 16
string(1) "C"
string(1) "C"

string(1) "C"
string(1) "C"

48 changes: 0 additions & 48 deletions hphp/test/slow/dynamic-calls/forbid-notice.php
Expand Up @@ -26,12 +26,6 @@ public static function positive_test1() {
try { parent::$x(); } catch (Exception $e) { wrap($e); }
}

public static function positive_test2() {
try { forward_static_call('C::foobar'); } catch (Exception $e) { wrap($e); }
try { forward_static_call(['C', 'foobar']); } catch (Exception $e) { wrap($e); }
try { forward_static_call([new C, 'foobar']); } catch (Exception $e) { wrap($e); }
}

public static function negative_test1() {
self::foobar();
static::foobar();
Expand All @@ -53,9 +47,6 @@ public static function negative_test1() {
self::$x();
static::$x();
parent::$x();
forward_static_call('E::foobar');
forward_static_call(['E', 'foobar']);
forward_static_call([new E, 'foobar']);
}
}

Expand Down Expand Up @@ -128,24 +119,6 @@ public static function static_cmp($x, $y) { return $x <=> $y; }
try { await parent::$x(); } catch (Exception $e) { wrap($e); }
}

public static function positive_test2() {
try { forward_static_call('func'); } catch (Exception $e) { wrap($e); }
try { forward_static_call('A::func'); } catch (Exception $e) { wrap($e); }
try { forward_static_call('A::static_func'); } catch (Exception $e) { wrap($e); }
try { forward_static_call(['A', 'func']); } catch (Exception $e) { wrap($e); }
try { forward_static_call(['A', 'static_func']); } catch (Exception $e) { wrap($e); }
try { forward_static_call([new A, 'func']); } catch (Exception $e) { wrap($e); }
try { forward_static_call([new A, 'static_func']); } catch (Exception $e) { wrap($e); }

try { forward_static_call_array('func', []); } catch (Exception $e) { wrap($e); }
try { forward_static_call_array('A::func', []); } catch (Exception $e) { wrap($e); }
try { forward_static_call_array('A::static_func', []); } catch (Exception $e) { wrap($e); }
try { forward_static_call_array(['A', 'func'], []); } catch (Exception $e) { wrap($e); }
try { forward_static_call_array(['A', 'static_func'], []); } catch (Exception $e) { wrap($e); }
try { forward_static_call_array([new A, 'func'], []); } catch (Exception $e) { wrap($e); }
try { forward_static_call_array([new A, 'static_func'], []); } catch (Exception $e) { wrap($e); }
}

public static async function negative_test1() {
self::func();
static::func();
Expand All @@ -167,9 +140,6 @@ public static function positive_test2() {
new static;
new parent;

forward_static_call('count', []);
forward_static_call_array('count', [[]]);

$x = 'func2';
self::$x();
static::$x();
Expand All @@ -190,21 +160,6 @@ public static function positive_test2() {
await static::$x();
await parent::$x();

forward_static_call('func2');
forward_static_call('A::func2');
forward_static_call('A::static_func2');
forward_static_call(['A', 'func2']);
forward_static_call(['A', 'static_func2']);
forward_static_call([new A, 'func2']);
forward_static_call([new A, 'static_func2']);

forward_static_call_array('func2', []);
forward_static_call_array('A::func2', []);
forward_static_call_array('A::static_func2', []);
forward_static_call_array(['A', 'func2'], []);
forward_static_call_array(['A', 'static_func2'], []);
forward_static_call_array([new A, 'func2'], []);
forward_static_call_array([new A, 'static_func2'], []);
}
}

Expand Down Expand Up @@ -293,9 +248,6 @@ class F extends A {
try { call_user_func_array([new A, 'func'], []); } catch (Exception $e) { wrap($e); }
try { call_user_func_array([new A, 'static_func'], []); } catch (Exception $e) { wrap($e); }

A::positive_test2();
C::positive_test2();

try { $x = 'cmp'; $y = [2, 1]; usort(&$y, $x); } catch (Exception $e) { wrap($e); }
try { $x = 'A::cmp'; $y = [2, 1]; usort(&$y, $x); } catch (Exception $e) { wrap($e); }
try { $x = 'A::static_cmp'; $y = [2, 1]; usort(&$y, $x); } catch (Exception $e) { wrap($e); }
Expand Down

0 comments on commit 55342a0

Please sign in to comment.