tony2001                Mon Jun 27 13:40:38 2005 EDT

  Modified files:              
    /php-src/ext/mysqli mysqli.c 
  Log:
  fix #33491 (crash after extending MySQLi internal class)
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli.c?r1=1.70&r2=1.71&ty=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.70 php-src/ext/mysqli/mysqli.c:1.71
--- php-src/ext/mysqli/mysqli.c:1.70    Wed Jun 22 05:12:43 2005
+++ php-src/ext/mysqli/mysqli.c Mon Jun 27 13:40:37 2005
@@ -15,7 +15,7 @@
   | Author: Georg Richter <[EMAIL PROTECTED]>                                |
   +----------------------------------------------------------------------+
 
-  $Id: mysqli.c,v 1.70 2005/06/22 09:12:43 georg Exp $ 
+  $Id: mysqli.c,v 1.71 2005/06/27 17:40:37 tony2001 Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -123,10 +123,19 @@
 static void mysqli_objects_free_storage(zend_object *object TSRMLS_DC)
 {
        mysqli_object   *intern = (mysqli_object *)object;
+       
+       zend_objects_free_object_storage(&(intern->zo) TSRMLS_CC);
+}
+/* }}} */
+
+/* {{{ mysqli_objects_destroy_object
+ */
+static void mysqli_objects_destroy_object(void *object, zend_object_handle 
handle TSRMLS_DC)
+{
+       mysqli_object   *intern = (mysqli_object *)object;
        MYSQLI_RESOURCE *my_res = (MYSQLI_RESOURCE *)intern->ptr;
 
-       zend_hash_destroy(intern->zo.properties);
-       FREE_HASHTABLE(intern->zo.properties);
+       zend_objects_destroy_object(object, handle TSRMLS_CC);
 
        /* link object */
        if (instanceof_function(intern->zo.ce, mysqli_link_class_entry 
TSRMLS_CC)) {
@@ -155,8 +164,8 @@
                        php_clear_warnings((MYSQLI_WARNING *)my_res->info);
                }
        }
+       intern->ptr = NULL;
        my_efree(my_res);
-       efree(object);
 }
 /* }}} */
 
@@ -354,7 +363,7 @@
        zend_hash_copy(intern->zo.properties, &class_type->default_properties, 
(copy_ctor_func_t) zval_add_ref,
                                        (void *) &tmp, sizeof(zval *));
 
-       retval.handle = zend_objects_store_put(intern, 
(zend_objects_store_dtor_t) zend_objects_destroy_object, 
(zend_objects_free_object_storage_t) mysqli_objects_free_storage, NULL 
TSRMLS_CC);
+       retval.handle = zend_objects_store_put(intern, 
(zend_objects_store_dtor_t) mysqli_objects_destroy_object, 
(zend_objects_free_object_storage_t) mysqli_objects_free_storage, NULL 
TSRMLS_CC);
        retval.handlers = &mysqli_object_handlers;
 
        return retval;

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to