diff options
author | Dmitry Stogov <dmitry@zend.com> | 2018-09-11 11:56:45 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2018-09-11 11:56:45 +0300 |
commit | 3a249e769b293afa454b18b8d894c3395683d26c (patch) | |
tree | 93d89c66728cb981136572bbc79e5a1ae756315a /Zend/zend_inheritance.c | |
parent | c4b14370cfc6884005d7976cf75af007e6f24e14 (diff) | |
download | php-git-3a249e769b293afa454b18b8d894c3395683d26c.tar.gz |
Squashed commit of the following:
commit 2d3cac9e005d6bef9aa73ab57cc674aa53125954
Author: Dmitry Stogov <dmitry@zend.com>
Date: Tue Sep 11 11:54:47 2018 +0300
Fixed static property access
commit 31786ee27282f319f3ef2a07635b1f325cbd67c6
Author: Dmitry Stogov <dmitry@zend.com>
Date: Tue Sep 11 11:05:29 2018 +0300
Avoid duplicate checks
commit 5ae502b979ea33d058d01a9421eec5afd0084e8d
Author: Dmitry Stogov <dmitry@zend.com>
Date: Tue Sep 11 10:39:17 2018 +0300
Optimization
commit 82c17f0e8af02c9cf7d1bbdae4e3158330148203
Author: Dmitry Stogov <dmitry@zend.com>
Date: Tue Sep 11 09:26:50 2018 +0300
Removed unused zend_duplicate_property_info()
commit ba53d1d0dd91d5530328a11cac93ff9e75c462b5
Merge: eacc11b8fd c4b14370cf
Author: Dmitry Stogov <dmitry@zend.com>
Date: Tue Sep 11 09:24:13 2018 +0300
Merge branch 'master' into shadow
* master:
7.0.33 next
Sync NEWS [ci skip]
add NEWS for 76582
Enforce ordering of property compare in object comparisons
Fixed wrong assertion
Skip test on unsuitable env
commit eacc11b8fdeb002ee6a149defd8b5a8c3412896a
Author: Dmitry Stogov <dmitry@zend.com>
Date: Mon Sep 10 13:12:39 2018 +0300
Fixed failure of ext/spl/tests/array_017.phpt
commit 62d1871430a1b81c84b790460afff0682648689a
Author: Dmitry Stogov <dmitry@zend.com>
Date: Mon Sep 10 11:55:07 2018 +0300
Fixed issues
commit 1d37e3a40e4d07c4b933ed6f9d2e649dd01180f0
Merge: d6c3f098b6 1e550e6f7e
Author: Dmitry Stogov <dmitry@zend.com>
Date: Mon Sep 10 10:21:20 2018 +0300
Merge branch 'master' into shadow
* master:
Update NEWS
Fix for bug #76582
Fix ssl stream reneg limit test to print only after first renegotiation
Make a copy unconditionally
Fix memory leak in pcre cache
Remove not needed checking for <errno.h>
Remove HAVE_ASSERT_H
Add test for bug #76850
Fixed bug #76850 Exit code mangled by set locale/preg_match
Remove empty PHP tags from test
Fix #75273: php_zlib_inflate_filter() may not update bytes_consumed
Fix PCRE2 exclusion and remove dead libs in Makefile.gcov
Report mem leaks to stderr if no Win debugger is present
Use combined assignment contanation operator
Fixed bug #76796
Support fixed address mmap without replacement
commit d6c3f098b6015e76d042691de0af2e1426c66829
Author: Dmitry Stogov <dmitry@zend.com>
Date: Fri Sep 7 13:56:30 2018 +0300
Get rid of ZEND_ACC_SHADOW
Diffstat (limited to 'Zend/zend_inheritance.c')
-rw-r--r-- | Zend/zend_inheritance.c | 50 |
1 files changed, 10 insertions, 40 deletions
diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c index c6a89754c9..eef6c5b3a5 100644 --- a/Zend/zend_inheritance.c +++ b/Zend/zend_inheritance.c @@ -31,20 +31,6 @@ static void overridden_ptr_dtor(zval *zv) /* {{{ */ } /* }}} */ -static zend_property_info *zend_duplicate_property_info(zend_property_info *property_info) /* {{{ */ -{ - zend_property_info* new_property_info; - - new_property_info = zend_arena_alloc(&CG(arena), sizeof(zend_property_info)); - memcpy(new_property_info, property_info, sizeof(zend_property_info)); - zend_string_addref(new_property_info->name); - if (new_property_info->doc_comment) { - zend_string_addref(new_property_info->doc_comment); - } - return new_property_info; -} -/* }}} */ - static zend_property_info *zend_duplicate_property_info_internal(zend_property_info *property_info) /* {{{ */ { zend_property_info* new_property_info = pemalloc(sizeof(zend_property_info), 1); @@ -171,16 +157,14 @@ static void do_inherit_parent_constructor(zend_class_entry *ce) /* {{{ */ char *zend_visibility_string(uint32_t fn_flags) /* {{{ */ { - if (fn_flags & ZEND_ACC_PRIVATE) { - return "private"; - } - if (fn_flags & ZEND_ACC_PROTECTED) { - return "protected"; - } if (fn_flags & ZEND_ACC_PUBLIC) { return "public"; + } else if (fn_flags & ZEND_ACC_PRIVATE) { + return "private"; + } else { + ZEND_ASSERT(fn_flags & ZEND_ACC_PROTECTED); + return "protected"; } - return ""; } /* }}} */ @@ -684,7 +668,7 @@ static void do_inherit_property(zend_property_info *parent_info, zend_string *ke if (UNEXPECTED(child)) { child_info = Z_PTR_P(child); - if (UNEXPECTED(parent_info->flags & (ZEND_ACC_PRIVATE|ZEND_ACC_SHADOW))) { + if (UNEXPECTED(parent_info->flags & ZEND_ACC_PRIVATE)) { child_info->flags |= ZEND_ACC_CHANGED; } else { if (UNEXPECTED((parent_info->flags & ZEND_ACC_STATIC) != (child_info->flags & ZEND_ACC_STATIC))) { @@ -711,20 +695,10 @@ static void do_inherit_property(zend_property_info *parent_info, zend_string *ke } } } else { - if (UNEXPECTED(parent_info->flags & ZEND_ACC_PRIVATE)) { - if (UNEXPECTED(ce->type & ZEND_INTERNAL_CLASS)) { - child_info = zend_duplicate_property_info_internal(parent_info); - } else { - child_info = zend_duplicate_property_info(parent_info); - } - child_info->flags &= ~ZEND_ACC_PRIVATE; /* it's not private anymore */ - child_info->flags |= ZEND_ACC_SHADOW; /* but it's a shadow of private */ + if (UNEXPECTED(ce->type & ZEND_INTERNAL_CLASS)) { + child_info = zend_duplicate_property_info_internal(parent_info); } else { - if (UNEXPECTED(ce->type & ZEND_INTERNAL_CLASS)) { - child_info = zend_duplicate_property_info_internal(parent_info); - } else { - child_info = parent_info; - } + child_info = parent_info; } _zend_hash_append_ptr(&ce->properties_info, key, child_info); } @@ -1681,11 +1655,7 @@ static void zend_do_traits_property_binding(zend_class_entry *ce, zend_class_ent /* next: check for conflicts with current class */ if ((coliding_prop = zend_hash_find_ptr(&ce->properties_info, prop_name)) != NULL) { - if (coliding_prop->flags & ZEND_ACC_SHADOW) { - zend_string_release_ex(coliding_prop->name, 0); - if (coliding_prop->doc_comment) { - zend_string_release_ex(coliding_prop->doc_comment, 0); - } + if ((coliding_prop->flags & ZEND_ACC_PRIVATE) && coliding_prop->ce != ce) { zend_hash_del(&ce->properties_info, prop_name); flags |= ZEND_ACC_CHANGED; } else { |