Always require $this on instance methods
commit0a47209aaf199be002beb772f0c468477a6feea4
authorPaul Bissonnette <paulbiss@fb.com>
Thu, 17 Oct 2019 06:54:13 +0000 (16 23:54 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Thu, 17 Oct 2019 06:57:09 +0000 (16 23:57 -0700)
tree9bc0140f92569ffc73692ddde2d6d10f9ee8ee36
parentac5b0592bb33d7c57b728d85714f6d3f3da5263c
Always require $this on instance methods

Summary:
We removed support for calling instance methods statically already so mark them as needing a `$this`. Follow up diffs to remove the attribute entirely.

It looks like we were still allowing calling instance methods statically in two places. (1) raw `invokeFunc` from the runtime, most notably for the `86*init` functions (added a verifier pass to stop this from happening and fix some tests), and (2) `call_user_func`.

Reviewed By: ottoni, jano, alexeyt

Differential Revision: D16060802

fbshipit-source-id: f8c2971908d8d92fbbf08ce8706e9f7614de5c6a
48 files changed:
hphp/hhbbc/index.cpp
hphp/runtime/base/builtin-functions.cpp
hphp/runtime/vm/as.cpp
hphp/runtime/vm/jit/inlining-decider.cpp
hphp/runtime/vm/verifier/check-func.cpp
hphp/test/quick/asm_prop_init.hhas
hphp/test/quick/check_init_prop.hhas
hphp/test/slow/dynamic-calls/cls_meth/forbid-notice.php
hphp/test/slow/dynamic-calls/cls_meth/forbid-notice.php.expectf
hphp/test/slow/dynamic-calls/cls_meth/forbid-throw.php
hphp/test/slow/dynamic-calls/cls_meth/forbid-throw.php.expectf
hphp/test/slow/dynamic-calls/constructs/forbid-notice.php
hphp/test/slow/dynamic-calls/constructs/forbid-notice.php.expectf
hphp/test/slow/dynamic-calls/constructs/forbid-throw.php
hphp/test/slow/dynamic-calls/constructs/forbid-throw.php.expectf
hphp/test/slow/dynamic-calls/forbid-notice-with-attr.php
hphp/test/slow/dynamic-calls/forbid-notice-with-attr.php.expectf
hphp/test/slow/dynamic-calls/forbid-notice.php
hphp/test/slow/dynamic-calls/forbid-notice.php.expectf
hphp/test/slow/dynamic-calls/forbid-throw.php
hphp/test/slow/dynamic-calls/forbid-throw.php.expectf
hphp/test/slow/dynamic-calls/func/forbid-notice.php
hphp/test/slow/dynamic-calls/func/forbid-notice.php.expectf
hphp/test/slow/dynamic-calls/func/forbid-throw.php
hphp/test/slow/dynamic-calls/func/forbid-throw.php.expectf
hphp/test/slow/dynamic-calls/inout.php
hphp/test/slow/dynamic-calls/inout.php.expect [moved from hphp/test/slow/dynamic-calls/inout.php.expectf with 69% similarity]
hphp/test/slow/dynamic-calls/inst_meth/forbid-notice.php
hphp/test/slow/dynamic-calls/inst_meth/forbid-notice.php.expectf
hphp/test/slow/dynamic-calls/inst_meth/forbid-throw.php
hphp/test/slow/dynamic-calls/inst_meth/forbid-throw.php.expectf
hphp/test/slow/dynamic-calls/memoize.php
hphp/test/slow/dynamic-calls/memoize.php.expect [moved from hphp/test/slow/dynamic-calls/memoize.php.expectf with 71% similarity]
hphp/test/slow/dynamic_methods/1212.php
hphp/test/slow/dynamic_methods/1212.php.expect [new file with mode: 0644]
hphp/test/slow/dynamic_methods/1212.php.expectf [deleted file]
hphp/test/slow/dynamic_methods/strings_with_colons.php
hphp/test/slow/dynamic_methods/strings_with_colons.php.expectf
hphp/test/slow/func-ptr/bad-func2.php
hphp/test/slow/func-ptr/bad-func2.php.expectf
hphp/test/slow/hack-arrays/callable-bad.php
hphp/test/slow/hack-arrays/callable-bad.php.expectf
hphp/test/slow/hhbbc/this_type_002.php.expectregex
hphp/test/slow/lang/cuf.php
hphp/test/slow/lang/cuf.php.expectf
hphp/test/slow/profile/setprofile-throw.php
hphp/test/slow/profile/setprofile-throw.php.expect [new file with mode: 0644]
hphp/test/slow/profile/setprofile-throw.php.expectf [deleted file]