diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2019-09-11 16:27:28 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-09-11 16:27:28 +0200 |
commit | 270e5e3c5b7b6bf39dfbef67381990b553a52a96 (patch) | |
tree | 3be47869ab46c9650ad488e7ea86c9c4a21f12f9 /Zend/zend_execute_API.c | |
parent | b7c353c8d03595f544b0ce87bf46e741f6a45ebe (diff) | |
download | php-git-270e5e3c5b7b6bf39dfbef67381990b553a52a96.tar.gz |
Only allow "nearly linked" classes for parent/interface
The requirements for parent/interface are difference than for the
variance checks in type declarations. The latter can work on fully
unlinked classes, but the former need inheritance to be essentially
finished, only variance checks may still be outstanding.
Adding a new flag for this because we have lots of space, but we
could also represent these "inheritance states" more compactly in
the future.
Diffstat (limited to 'Zend/zend_execute_API.c')
-rw-r--r-- | Zend/zend_execute_API.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 4f7f54f893..ddef72ebd3 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -917,8 +917,12 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, zend_string * zend_string_release_ex(lc_name, 0); } ce = (zend_class_entry*)Z_PTR_P(zv); - if (UNEXPECTED(!(ce->ce_flags & ZEND_ACC_LINKED)) && - !(flags & ZEND_FETCH_CLASS_ALLOW_UNLINKED)) { + if (UNEXPECTED(!(ce->ce_flags & ZEND_ACC_LINKED))) { + if ((flags & ZEND_FETCH_CLASS_ALLOW_UNLINKED) || + ((flags & ZEND_FETCH_CLASS_ALLOW_NEARLY_LINKED) && + (ce->ce_flags & ZEND_ACC_NEARLY_LINKED))) { + return ce; + } return NULL; } return ce; |