Skip to content

Commit

Permalink
Don't track internal class dependencies
Browse files Browse the repository at this point in the history
Subtyping relationships established on internal classes are always
going to hold (if we ignore Windows), so there is no need to
explicitly track them.

This fixes an assertion failure in GH-7251.
  • Loading branch information
nikic committed Jul 19, 2021
1 parent 58fb147 commit a837d35
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Zend/zend_inheritance.c
Original file line number Diff line number Diff line change
Expand Up @@ -376,13 +376,17 @@ static void track_class_dependency(zend_class_entry *ce, zend_string *class_name
return;
}

#ifndef ZEND_WIN32
/* On non-Windows systems, internal classes are always the same,
* so there is no need to explicitly track them. */
if (ce->type == ZEND_INTERNAL_CLASS) {
return;
}
#endif

ht = (HashTable*)CG(current_linking_class)->inheritance_cache;

#ifndef ZEND_WIN32
if (ce->type == ZEND_USER_CLASS && !(ce->ce_flags & ZEND_ACC_IMMUTABLE)) {
#else
if (!(ce->ce_flags & ZEND_ACC_IMMUTABLE)) {
#endif
// TODO: dependency on not-immutable class ???
if (ht) {
zend_hash_destroy(ht);
Expand Down

0 comments on commit a837d35

Please sign in to comment.