Skip to content

Commit d52ed96

Browse files
Merge branch 'master' of github.com:CopernicaMarketingSoftware/PHP-CPP
2 parents 84b262e + ea3e14b commit d52ed96

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

zend/classimpl.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1366,8 +1366,11 @@ zend_class_entry *ClassImpl::initialize(ClassBase *base, const std::string &pref
13661366
// initialize the class entry
13671367
INIT_CLASS_ENTRY_EX(entry, _name.c_str(), _name.size(), entries());
13681368

1369-
// we need a special constructor
1370-
entry.create_object = &ClassImpl::createObject;
1369+
// we need a special constructor, but only for real classes, not for interfaces.
1370+
// (in fact: from php 7.4 onwards the create_object method is part of union
1371+
// together with the interface_gets_implemented method, which causes a crash
1372+
// when the create_object property is set for an interface)
1373+
if (_type != ClassType::Interface) entry.create_object = &ClassImpl::createObject;
13711374

13721375
// register function that is called for static method calls
13731376
entry.get_static_method = &ClassImpl::getStaticMethod;
@@ -1419,7 +1422,7 @@ zend_class_entry *ClassImpl::initialize(ClassBase *base, const std::string &pref
14191422
_entry = zend_register_internal_class(&entry);
14201423
}
14211424

1422-
// register the classes
1425+
// register the interfaces
14231426
for (auto &interface : _interfaces)
14241427
{
14251428
// register this interface

0 commit comments

Comments
 (0)