summaryrefslogtreecommitdiff
path: root/ext/mysqli/mysqli.c
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2005-06-27 17:40:37 +0000
committerAntony Dovgal <tony2001@php.net>2005-06-27 17:40:37 +0000
commitb16beb540c39c98a4ee85223451f376eff9d8195 (patch)
tree9a7a3207d35c717f7a49d30b5105dace332b9921 /ext/mysqli/mysqli.c
parent689f3488a50ee330c95fbbb5b86c4f6e4253cbf9 (diff)
downloadphp-git-b16beb540c39c98a4ee85223451f376eff9d8195.tar.gz
fix #33491 (crash after extending MySQLi internal class)
Diffstat (limited to 'ext/mysqli/mysqli.c')
-rw-r--r--ext/mysqli/mysqli.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c
index bc2f596cb7..e2b11f076a 100644
--- a/ext/mysqli/mysqli.c
+++ b/ext/mysqli/mysqli.c
@@ -123,10 +123,19 @@ void php_clear_mysql(MY_MYSQL *mysql) {
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 @@ static void mysqli_objects_free_storage(zend_object *object TSRMLS_DC)
php_clear_warnings((MYSQLI_WARNING *)my_res->info);
}
}
+ intern->ptr = NULL;
my_efree(my_res);
- efree(object);
}
/* }}} */
@@ -354,7 +363,7 @@ PHP_MYSQLI_EXPORT(zend_object_value) mysqli_objects_new(zend_class_entry *class_
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;