logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

cvs: ZendEngine2 / zend_objects_API.c /tests bug34617.phpt: msg#00097

Subject: cvs: ZendEngine2 / zend_objects_API.c /tests bug34617.phpt
dmitry          Tue Sep 27 14:08:27 2005 EDT

  Modified files:              
    /ZendEngine2        zend_objects_API.c 
    /ZendEngine2/tests  bug34617.phpt 
  Log:
  Fixed bug #34617 (zend_deactivate: objects_store used after 
zend_objects_store_destroy is called)
  
  
http://cvs.php.net/diff.php/ZendEngine2/zend_objects_API.c?r1=1.48&r2=1.49&ty=u
Index: ZendEngine2/zend_objects_API.c
diff -u ZendEngine2/zend_objects_API.c:1.48 ZendEngine2/zend_objects_API.c:1.49
--- ZendEngine2/zend_objects_API.c:1.48 Thu Aug 11 19:34:58 2005
+++ ZendEngine2/zend_objects_API.c      Tue Sep 27 14:08:26 2005
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_objects_API.c,v 1.48 2005/08/11 23:34:58 andrei Exp $ */
+/* $Id: zend_objects_API.c,v 1.49 2005/09/27 18:08:26 dmitry Exp $ */
 
 #include "zend.h"
 #include "zend_globals.h"
@@ -38,6 +38,7 @@
 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)
@@ -138,8 +139,15 @@
 
 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
http://cvs.php.net/diff.php/ZendEngine2/tests/bug34617.phpt?r1=1.1&r2=1.2&ty=u
Index: ZendEngine2/tests/bug34617.phpt
diff -u /dev/null ZendEngine2/tests/bug34617.phpt:1.2
--- /dev/null   Tue Sep 27 14:08:27 2005
+++ ZendEngine2/tests/bug34617.phpt     Tue Sep 27 14:08:26 2005
@@ -0,0 +1,18 @@
+--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 Engine CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




<Prev in Thread] Current Thread [Next in Thread>