php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64726 Segfault when calling fetch_object on a use_result and DB pointer has closed
Submitted: 2013-04-26 17:35 UTC Modified: 2013-04-27 07:37 UTC
From: justin at eblah dot com Assigned: mysql (profile)
Status: Closed Package: MySQLi related
PHP Version: 5.4.14 OS: CentOS 5.9
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: justin at eblah dot com
New email:
PHP Version: OS:

 

 [2013-04-26 17:35 UTC] justin at eblah dot com
Description:
------------
When using MYSQLI_USE_RESULT, then immediately closing the database, and then attempting to fetch_object() the result will result in a segmentation fault.

PHP does not segfault if using fetch_array() or fetch_assoc().

Test script:
---------------
<?php

$db = new mysqli("127.0.0.1", "root", "root", "test");
$result = $db->query('SELECT 1', MYSQLI_USE_RESULT);
$db->close();
$result->fetch_object();

Expected result:
----------------
An exception or php fatal error that states the database was closed.

Actual result:
--------------
[root@devz user]# /usr/bin/php segfault.php

Warning: mysqli_result::fetch_object(): Error while reading a row in segfault.php on line 15
Segmentation fault


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-04-26 17:46 UTC] justin at eblah dot com
Reworded summary.
 [2013-04-26 17:46 UTC] justin at eblah dot com
-Summary: Segfault on fetch_object on used result Closed DB Pointer +Summary: Segfault when calling fetch_object on a use_result and DB pointer has closed
 [2013-04-27 07:37 UTC] johannes@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: mysql
 [2013-04-27 15:42 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=8f5a534b215905790a4dd5465804c1fbc21468c4
Log: Fixed bug #64726 (Segfault when calling fetch_object on a use_result and DB pointer has closed)
 [2013-04-27 15:42 UTC] laruence@php.net
-Status: Assigned +Status: Closed
 [2013-04-27 15:50 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=15b554cd9ba6b8553f45ea8408b3f0386965bef6
Log: Also fixed bug #64726 in 5.3
 [2014-10-07 23:19 UTC] stas@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=15b554cd9ba6b8553f45ea8408b3f0386965bef6
Log: Also fixed bug #64726 in 5.3
 [2014-10-07 23:19 UTC] stas@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=8f5a534b215905790a4dd5465804c1fbc21468c4
Log: Fixed bug #64726 (Segfault when calling fetch_object on a use_result and DB pointer has closed)
 [2014-10-07 23:30 UTC] stas@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=15b554cd9ba6b8553f45ea8408b3f0386965bef6
Log: Also fixed bug #64726 in 5.3
 [2014-10-07 23:30 UTC] stas@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=8f5a534b215905790a4dd5465804c1fbc21468c4
Log: Fixed bug #64726 (Segfault when calling fetch_object on a use_result and DB pointer has closed)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 04:01:29 2024 UTC