--- /dev/null
+--TEST--
+Bug #34617 (zend_deactivate: objects_store used after zend_objects_store_destroy is called)
+--SKIPIF--
+<?php if (!extension_loaded("xml")) print "skip"; ?>
+--FILE--
+<?php
+class Thing {}
+function boom()
+{
+ $reader = xml_parser_create();
+ xml_set_object($reader, new Thing());
+ die("ok\n");
+ xml_parser_free($reader);
+}
+boom();
+?>
+--EXPECT--
+ok
\ No newline at end of file
ZEND_API void zend_objects_store_destroy(zend_objects_store *objects)
{
efree(objects->object_buckets);
+ objects->object_buckets = NULL;
}
ZEND_API void zend_objects_store_call_destructors(zend_objects_store *objects TSRMLS_DC)
ZEND_API void zend_objects_store_del_ref(zval *zobject TSRMLS_DC)
{
- zend_object_handle handle = Z_OBJ_HANDLE_P(zobject);
- struct _store_object *obj = &EG(objects_store).object_buckets[handle].bucket.obj;
+ zend_object_handle handle;
+ struct _store_object *obj;
+
+ if (!EG(objects_store).object_buckets) {
+ return;
+ }
+
+ handle = Z_OBJ_HANDLE_P(zobject);
+ obj = &EG(objects_store).object_buckets[handle].bucket.obj;
/* Make sure we hold a reference count during the destructor call
otherwise, when the destructor ends the storage might be freed