From 7684d72df8a55f9c23e80091c89818d870d7a108 Mon Sep 17 00:00:00 2001 From: Julien Pauli Date: Fri, 20 Feb 2015 13:38:35 +0100 Subject: [PATCH] Fix #63486 --- ext/mysqli/php_mysqli_structs.h | 1 + ext/mysqli/tests/bug63486.phpt | 55 +++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 ext/mysqli/tests/bug63486.phpt diff --git a/ext/mysqli/php_mysqli_structs.h b/ext/mysqli/php_mysqli_structs.h index d061bfb21a..e6dafea58c 100644 --- a/ext/mysqli/php_mysqli_structs.h +++ b/ext/mysqli/php_mysqli_structs.h @@ -313,6 +313,7 @@ extern PHPAPI zend_class_entry *spl_ce_RuntimeException; mysqli_object *intern = (mysqli_object *)zend_object_store_get_object(*(__id) TSRMLS_CC);\ efree(intern->ptr); \ intern->ptr = NULL; \ + ZVAL_NULL(*__id); \ } diff --git a/ext/mysqli/tests/bug63486.phpt b/ext/mysqli/tests/bug63486.phpt new file mode 100644 index 0000000000..72b8663e43 --- /dev/null +++ b/ext/mysqli/tests/bug63486.phpt @@ -0,0 +1,55 @@ +--TEST-- +mysqli_free_resource() - resets the zval to NULL +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +array(1) { + [0]=> + string(1) "1" +} +object(mysqli_result)#3 (5) { + ["current_field"]=> + int(0) + ["field_count"]=> + int(1) + ["lengths"]=> + array(1) { + [0]=> + int(1) + } + ["num_rows"]=> + int(1) + ["type"]=> + int(0) +} +array(1) { + [0]=> + string(1) "1" +} +NULL -- 2.40.0