diff options
author | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-03-21 15:06:09 +0100 |
---|---|---|
committer | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-03-21 15:06:09 +0100 |
commit | 5852a65e876421b118de9e76a9f83388be590690 (patch) | |
tree | d8cef288da5deb5b9f9944dd78f6834e643cd37d /src | |
parent | 7abf35a68a50a611b886ad08c88ad1d314b98ec6 (diff) |
fixed crashes for certain test cases on php 5.3
Diffstat (limited to 'src')
-rw-r--r-- | src/base.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/base.cpp b/src/base.cpp index f677bcf..fd8e462 100644 --- a/src/base.cpp +++ b/src/base.cpp @@ -28,22 +28,22 @@ MixedObject *Base::store(zend_class_entry *entry) // store the class entry in the newly created object result->php.ce = entry; - // @todo is this really necessary - and when do we destruct this data? - // (if we remove this code, everything breaks down in a for ($object as $k => $v) loop) + // initialize the object + zend_object_std_init(&result->php, entry); - // the original create_object fills the initial object with the default properties, - // we're going to do exactly the same. start with setting up a hashtable for the props - ALLOC_HASHTABLE(result->php.properties); +#if PHP_VERSION_ID < 50399 - // initialize the hash table - zend_hash_init(result->php.properties, 0, NULL, ZVAL_PTR_DTOR, 0); + // tmp variable + zval *tmp; + + // initialize the properties, php 5.3 way + zend_hash_copy(result->php.properties, &entry->default_properties, (copy_ctor_func_t) zval_property_ctor, &tmp, sizeof(zval*)); -#if PHP_VERSION_ID < 50399 - // initialize the properties - zend_hash_copy(result->php.properties, &entry->default_properties, (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval*)); #else + // version higher than 5.3 have an easier way to initialize object_properties_init(&result->php, entry); + #endif // the destructor and clone handlers are set to NULL. I dont know why, but they do not |