[Fix] is_callable should respect __call and __callStatic
commitd8d89afa1efca3cfa627c23ce4e5f1ca77f783e3
authormwilliams <mwilliams@fb.com>
Tue, 4 Oct 2011 17:47:35 +0000 (4 10:47 -0700)
committermacvicar <macvicar@fb.com>
Tue, 18 Oct 2011 01:06:00 +0000 (17 18:06 -0700)
tree4f3a503267234f02cd47360766514d9eea397bd1
parent30a76e2eb1b8f2aa7444dcb1ffd0a4ce99016219
[Fix] is_callable should respect __call and __callStatic

Summary:
is_callable didnt check for __call, or __callStatic. It also didnt handle all
the possible array formats. Since I'd recently updated call_user_func etc to go
through a common routine to handle that, I decided to point is_callable at the
same code.

The one problem is that is_callable respects private and protected, where
currently call_user_func etc do not. I will fix that in a later diff, but for
now, I've added flags to CallInfo to indicate that its private or protected, and
when is_callable finds a private or protected method, it uses ClassInfo to
determine whether its accessible (this isnt very efficient, but its no worse
than it used to be).

Test Plan: fast_tests slow_tests

Reviewers: qigao, myang

Reviewed By: myang

CC: ps, mwilliams, myang
Differential Revision: 343168

Task ID: 740787
13 files changed:
src/compiler/analysis/class_scope.cpp
src/compiler/analysis/function_scope.cpp
src/runtime/base/builtin_functions.cpp
src/runtime/base/builtin_functions.h
src/runtime/base/object_data.cpp
src/runtime/eval/ast/method_statement.cpp
src/runtime/ext/ext_function.cpp
src/system/gen/php/classes/iterator.cpp
src/system/gen/php/classes/reflection.cpp
src/system/gen/sys/dynamic_table_class.cpp
src/test/test_ext_fb.cpp
src/test/test_ext_function.cpp
src/test/test_externals.cpp