From: Dmitry Stogov Date: Thu, 13 Sep 2018 10:47:06 +0000 (+0300) Subject: Remove zend_check_private() X-Git-Tag: php-7.4.0alpha1~1928 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=49b92446d780bcb750d65148bc4ad1519bf66fb3;p=php Remove zend_check_private() --- diff --git a/UPGRADING.INTERNALS b/UPGRADING.INTERNALS index 526223ddf5..fdcb046a58 100644 --- a/UPGRADING.INTERNALS +++ b/UPGRADING.INTERNALS @@ -4,6 +4,7 @@ PHP 7.4 INTERNALS UPGRADE NOTES a. php_sys_symlink() and php_sys_link() b. zend_lookup_class_ex() and zend_fetch_class_by_name() c. Function/property/class flags + d. Removed zend_check_private() 2. Build system changes a. Unix build system changes @@ -35,6 +36,8 @@ PHP 7.4 INTERNALS UPGRADE NOTES check property_info->ce (in the same way as with methods). - ZEND_ACC_... flags are re-numbered. + d. zend_check_private() is removed. Use (func->common.scope == scope) instead. + ======================== 2. Build system changes ======================== diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index b664762469..05c970da8b 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -1102,36 +1102,6 @@ static zend_never_inline zend_function *zend_get_parent_private_method(zend_clas } /* }}} */ -/* Ensures that we're allowed to call a private method. - * Returns the function address that should be called, or NULL - * if no such function exists. - */ -ZEND_API int zend_check_private(zend_function *fbc, zend_class_entry *ce, zend_string *function_name) /* {{{ */ -{ - zend_class_entry *scope; - - if (!ce) { - return 0; - } - - /* We may call a private function if: - * 1. The class of our object is the same as the scope, and the private - * function (EX(fbc)) has the same scope. - * 2. One of our parent classes are the same as the scope, and it contains - * a private function with the same name that has the same scope. - */ - scope = zend_get_executed_scope(); - if (fbc->common.scope == scope) { - /* rule #1 checks out ok, allow the function call */ - return 1; - } - - - /* Check rule #2 */ - return zend_get_parent_private_method(scope, ce, function_name) != NULL; -} -/* }}} */ - /* Ensures that we're allowed to call a protected method. */ ZEND_API int zend_check_protected(zend_class_entry *ce, zend_class_entry *scope) /* {{{ */ diff --git a/Zend/zend_object_handlers.h b/Zend/zend_object_handlers.h index 662b881d99..9437aaaf76 100644 --- a/Zend/zend_object_handlers.h +++ b/Zend/zend_object_handlers.h @@ -199,8 +199,6 @@ ZEND_API int zend_std_compare_objects(zval *o1, zval *o2); ZEND_API int zend_std_get_closure(zval *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **obj_ptr); ZEND_API void rebuild_object_properties(zend_object *zobj); -ZEND_API int zend_check_private(zend_function *fbc, zend_class_entry *ce, zend_string *function_name); - ZEND_API int zend_check_protected(zend_class_entry *ce, zend_class_entry *scope); ZEND_API int zend_check_property_access(zend_object *zobj, zend_string *prop_info_name);