summaryrefslogtreecommitdiff
path: root/zend/object.cpp
diff options
context:
space:
mode:
authorEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-12-16 12:47:11 +0100
committerEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-12-16 12:47:11 +0100
commitff9a22782a7d28b11af0ff2d3948a196ab12d003 (patch)
tree3fcb8020cb0dce094abefbbecb83055fc31ed1fd /zend/object.cpp
parentda4de6cb1097471b2659c102d55a646cbc9e0f41 (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.cpp6
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));