Edit report at https://bugs.php.net/bug.php?id=64726&edit=1

 ID:                 64726
 User updated by:    justin at eblah dot com
 Reported by:        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
 Status:             Open
 Type:               Bug
 Package:            MySQLi related
 Operating System:   CentOS 5.9
 PHP Version:        5.4.14
 Block user comment: N
 Private report:     N

 New Comment:

Reworded summary.


Previous Comments:
------------------------------------------------------------------------
[2013-04-26 17:35:58] 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



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=64726&edit=1

Reply via email to