summaryrefslogtreecommitdiff
path: root/zend/classimpl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'zend/classimpl.cpp')
-rw-r--r--zend/classimpl.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/zend/classimpl.cpp b/zend/classimpl.cpp
index ab95455..82cbc66 100644
--- a/zend/classimpl.cpp
+++ b/zend/classimpl.cpp
@@ -20,6 +20,11 @@ ClassImpl::~ClassImpl()
{
// destruct the entries
if (_entries) delete[] _entries;
+
+#if PHP_VERSION_ID >= 50400
+ // on newer php versions, we have allocated the command to hide a pointer in it
+ if (_self) free(_self);
+#endif
}
/**
@@ -1419,16 +1424,16 @@ zend_class_entry *ClassImpl::initialize(ClassBase *base, const std::string &pref
#if PHP_VERSION_ID >= 50400
// allocate doc comment to contain an empty string + a hidden pointer
- char *_comment = (char *)malloc(1 + sizeof(ClassImpl *));
+ _self = (char *)malloc(1 + sizeof(ClassImpl *));
// empty string on first position
- _comment[0] = '\0';
+ _self[0] = '\0';
// copy the 'this' pointer to the doc-comment
- memcpy(_comment+1, &impl, sizeof(ClassImpl *));
+ memcpy(_self+1, &impl, sizeof(ClassImpl *));
// set our comment in the actual class entry
- _entry->info.user.doc_comment = _comment;
+ _entry->info.user.doc_comment = _self;
#else