Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12:Update
php7.15211
php7-Fix-bug-66773-66862.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File php7-Fix-bug-66773-66862.patch of Package php7.15211
From 2a75f5026a47099f585e29c5a9d8a2989dab42af Mon Sep 17 00:00:00 2001 From: Nikita Popov <nikic@php.net> Date: Sat, 8 Oct 2016 16:56:17 +0200 Subject: [PATCH] Fix bug #66773, #66862 This a partial backport of 8754b19. It a) fixes the class/function/constant import table confusion in the namespaced case, and b) restricts conflict checks to a single file based on a filename pointer comparison. It does not fix the issues with filename reuse (e.g. due to eval) and late-bound classes. This part of the change requires globals changes. diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 53cafcb56d..eb373906eb 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -5499,6 +5499,41 @@ static void zend_check_already_in_use(uint32_t type, zend_string *old_name, zend } /* }}} */ +static void zend_check_use_conflict( + uint32_t type, zend_string *old_name, zend_string *new_name, zend_string *lookup_name) { + switch (type) { + case T_CLASS: + { + zend_class_entry *ce = zend_hash_find_ptr(CG(class_table), lookup_name); + if (ce && ce->type == ZEND_USER_CLASS + && ce->info.user.filename == CG(compiled_filename) + ) { + zend_check_already_in_use(type, old_name, new_name, lookup_name); + } + break; + } + case T_FUNCTION: + { + zend_function *fn = zend_hash_find_ptr(CG(function_table), lookup_name); + if (fn && fn->type == ZEND_USER_FUNCTION + && fn->op_array.filename == CG(compiled_filename) + ) { + zend_check_already_in_use(type, old_name, new_name, lookup_name); + } + break; + } + case T_CONST: + { + zend_string *filename = zend_hash_find_ptr(&CG(const_filenames), lookup_name); + if (filename && filename == CG(compiled_filename)) { + zend_check_already_in_use(type, old_name, new_name, lookup_name); + } + break; + } + EMPTY_SWITCH_DEFAULT_CASE() + } +} + void zend_compile_use(zend_ast *ast) /* {{{ */ { zend_ast_list *list = zend_ast_get_list(ast); @@ -5555,43 +5590,11 @@ void zend_compile_use(zend_ast *ast) /* {{{ */ ZSTR_VAL(ns_name)[ZSTR_LEN(current_ns)] = '\\'; memcpy(ZSTR_VAL(ns_name) + ZSTR_LEN(current_ns) + 1, ZSTR_VAL(lookup_name), ZSTR_LEN(lookup_name)); - if (zend_hash_exists(CG(class_table), ns_name)) { - zend_check_already_in_use(type, old_name, new_name, ns_name); - } + zend_check_use_conflict(type, old_name, new_name, ns_name); zend_string_free(ns_name); } else { - switch (type) { - case T_CLASS: - { - zend_class_entry *ce = zend_hash_find_ptr(CG(class_table), lookup_name); - if (ce && ce->type == ZEND_USER_CLASS - && ce->info.user.filename == CG(compiled_filename) - ) { - zend_check_already_in_use(type, old_name, new_name, lookup_name); - } - break; - } - case T_FUNCTION: - { - zend_function *fn = zend_hash_find_ptr(CG(function_table), lookup_name); - if (fn && fn->type == ZEND_USER_FUNCTION - && fn->op_array.filename == CG(compiled_filename) - ) { - zend_check_already_in_use(type, old_name, new_name, lookup_name); - } - break; - } - case T_CONST: - { - zend_string *filename = zend_hash_find_ptr(&CG(const_filenames), lookup_name); - if (filename && filename == CG(compiled_filename)) { - zend_check_already_in_use(type, old_name, new_name, lookup_name); - } - break; - } - EMPTY_SWITCH_DEFAULT_CASE() - } + zend_check_use_conflict(type, old_name, new_name, lookup_name); } zend_string_addref(old_name); -- 2.13.5
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor