From 8f5a534b215905790a4dd5465804c1fbc21468c4 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sat, 27 Apr 2013 23:41:31 +0800 Subject: [PATCH] Fixed bug #64726 (Segfault when calling fetch_object on a use_result and DB pointer has closed) --- NEWS | 4 ++++ ext/mysqli/mysqli.c | 2 +- ext/mysqli/tests/bug64726.phpt | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 59871310c7e..3d37baf5b15 100644 --- a/NEWS +++ b/NEWS @@ -17,6 +17,10 @@ PHP NEWS - Fileinfo: . Upgraded libmagic to 5.14. (Anatol) +- MySQLi: + . Fixed bug #64726 (Segfault when calling fetch_object on a use_result and DB + pointer has closed). (Laruence) + - Zip: . Fixed bug #64342 (ZipArchive::addFile() has to check for file existence). (Anatol) diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c index a4c1b874fdc..45e39d0b45b 100644 --- a/ext/mysqli/mysqli.c +++ b/ext/mysqli/mysqli.c @@ -1257,7 +1257,7 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags php_mysqli_fetch_into_hash_aux(return_value, result, fetchtype TSRMLS_CC); - if (into_object && Z_TYPE_P(return_value) != IS_NULL) { + if (into_object && Z_TYPE_P(return_value) == IS_ARRAY) { zval dataset = *return_value; zend_fcall_info fci; zend_fcall_info_cache fcc; diff --git a/ext/mysqli/tests/bug64726.phpt b/ext/mysqli/tests/bug64726.phpt index 3e43916d35b..1f9bbaa93ec 100644 --- a/ext/mysqli/tests/bug64726.phpt +++ b/ext/mysqli/tests/bug64726.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #63398 (Memleak when calling fetch_object on a use_result and DB pointer has closed) +Bug #63398 (Segfault when calling fetch_object on a use_result and DB pointer has closed) --SKIPIF--