Merge branch 'PHP-8.1'

* PHP-8.1:
  Don't implement Stringable on traits
This commit is contained in:
Nikita Popov 2021-11-05 09:48:33 +01:00
commit 2d38f701e0
6 changed files with 30 additions and 10 deletions

View file

@ -2885,7 +2885,8 @@ ZEND_API zend_class_entry *zend_do_link_class(zend_class_entry *ce, zend_string
/* Normally Stringable is added during compilation. However, if it is imported from a trait,
* we need to explicilty add the interface here. */
if (ce->__tostring && !zend_class_implements_interface(ce, zend_ce_stringable)) {
if (ce->__tostring && !(ce->ce_flags & ZEND_ACC_TRAIT)
&& !zend_class_implements_interface(ce, zend_ce_stringable)) {
ZEND_ASSERT(ce->__tostring->common.fn_flags & ZEND_ACC_TRAIT_CLONE);
ce->ce_flags |= ZEND_ACC_RESOLVED_INTERFACES;
ce->num_interfaces++;