From 15b554cd9ba6b8553f45ea8408b3f0386965bef6 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sat, 27 Apr 2013 23:49:43 +0800 Subject: [PATCH] Also fixed bug #64726 in 5.3 --- NEWS | 4 ++++ ext/mysqli/mysqli.c | 2 +- ext/mysqli/tests/bug64726.phpt | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 5ea0f5a2f8..284a31a7c7 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,10 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2013, PHP 5.3.26 +- MySQLi: + . Fixed bug #64726 (Segfault when calling fetch_object on a use_result and DB + pointer has closed). (Laruence) + ?? ??? 2013, PHP 5.3.25 ### ADD ENTRIES ABOVE FOR 5.3.26. 5.3.25 NEWS WILL BE UPDATED BY RM ON MERGE ### diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c index 86f6070e6d..2941b4a899 100644 --- a/ext/mysqli/mysqli.c +++ b/ext/mysqli/mysqli.c @@ -1259,7 +1259,7 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags #endif - 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 3e43916d35..83c4e3c1e9 100644 --- a/ext/mysqli/tests/bug64726.phpt +++ b/ext/mysqli/tests/bug64726.phpt @@ -16,8 +16,8 @@ $db = new my_mysqli($host, $user, $passwd, $db, $port, $socket); $result = $db->query('SELECT 1', MYSQLI_USE_RESULT); $db->close(); -var_dump($result->fetch_array()); +var_dump($result->fetch_object()); ?> --EXPECTF-- -Warning: mysqli_result::fetch_array(): Error while reading a row in %sbug64726.php on line %d +Warning: mysqli_result::fetch_object(): Error while reading a row in %sbug64726.php on line %d bool(false) -- 2.40.0