From 80e9566d52a682b011e38083fbe18f233298f03e Mon Sep 17 00:00:00 2001 From: valmat Date: Mon, 23 Jun 2014 20:16:58 +0600 Subject: Fixed issue #100 --- zend/classimpl.cpp | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'zend/classimpl.cpp') diff --git a/zend/classimpl.cpp b/zend/classimpl.cpp index ca75c5e..23c39cf 100644 --- a/zend/classimpl.cpp +++ b/zend/classimpl.cpp @@ -1382,14 +1382,25 @@ void ClassImpl::initialize(ClassBase *base, const std::string &prefix TSRMLS_DC) if (_parent) { // check if the base class was already defined - if (_parent->_entry) entry.parent = _parent->_entry; - + if (_parent->_entry) + { + // register the class + _entry = zend_register_internal_class_ex(&entry, _parent->_entry, const_cast(_parent->name().c_str()) TSRMLS_CC); + } + // otherwise an error is reported - else std::cerr << "Derived class " << name() << " is initialized before base class " << _parent->name() << ": base class is ignored" << std::endl; + else + { + std::cerr << "Derived class " << name() << " is initialized before base class " << _parent->name() << ": base class is ignored" << std::endl; + // register the class + _entry = zend_register_internal_class(&entry TSRMLS_CC); + } + } + else + { + // register the class + _entry = zend_register_internal_class(&entry TSRMLS_CC); } - - // register the class - _entry = zend_register_internal_class(&entry TSRMLS_CC); // register the classes for (auto &interface : _interfaces) -- cgit v1.2.3