diff options
author | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-12-16 12:47:11 +0100 |
---|---|---|
committer | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-12-16 12:47:11 +0100 |
commit | ff9a22782a7d28b11af0ff2d3948a196ab12d003 (patch) | |
tree | 3fcb8020cb0dce094abefbbecb83055fc31ed1fd /zend/object.cpp | |
parent | da4de6cb1097471b2659c102d55a646cbc9e0f41 (diff) |
fix issue #151, chaining method calls was not working as it should because the per-object refcount was not updated correctly, which caused an object to be destructed even when it already was assigned to a different variable
Diffstat (limited to 'zend/object.cpp')
-rw-r--r-- | zend/object.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/zend/object.cpp b/zend/object.cpp index 4af6204..22431fe 100644 --- a/zend/object.cpp +++ b/zend/object.cpp @@ -40,8 +40,10 @@ Object::Object(const char *name, Base *base) : Value() if (!entry) throw FatalError(std::string("Unknown class name ") + name); // construct an implementation (this will also set the implementation - // member in the base object) - new ObjectImpl(entry, base TSRMLS_CC); + // member in the base object), this is a self-destructing object that + // will be destructed when the last reference to it has been removed, + // we already set the reference to zero + new ObjectImpl(entry, base, 0 TSRMLS_CC); // now we can store it operator=(Value(base)); |