Bug #63486 [Ver]: mysqli_free_result leave the resource variable in a messy state

From: Date: Sat, 21 Feb 2015 09:57:16 +0000
Subject: Bug #63486 [Ver]: mysqli_free_result leave the resource variable in a messy state
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-190862@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=63486&edit=1

 ID:                 63486
 Updated by:         derick@php.net
 Reported by:        derick@php.net
 Summary:            mysqli_free_result leave the resource variable in a
                     messy state
 Status:             Verified
 Type:               Bug
 Package:            MySQLi related
 PHP Version:        5.4.8
 Assigned To:        mysql
 Block user comment: N
 Private report:     N

 New Comment:

Ulf said that more than two years ago, and nothing has happened since. I'll be merging this
into 7 unless somebody beats me.


Previous Comments:
------------------------------------------------------------------------
[2015-02-20 12:43:21] jpauli@php.net

For me, Derick's patch is all right to get merged against 5.5

I PR'ed it at https://github.com/php/php-src/pull/1104

Like ulf says, it will break bad codes reusing the mysqli resource as an object (because we now NULL
it, so it's not an object anymore), but the mysqli resource was anyway in a bad state, so for
me this is clearly a fix that could get merged.

------------------------------------------------------------------------
[2015-01-16 08:57:49] hans dot puac at gmail dot com

This Problem still exists in different PHP-Versions.
I got it in 5.5.9 and 5.6.3 with XAMPP on Windows 7.
Please fix this bug!

And here a little workaround for all developer who want to use xDebug now.
function free_result_fix(&$rs){
  $out = mysqli_free_result($rs);
  $rs = null;
  return $out;
}

Replace every mysqli_free_result with the free_result_fix and xDebug will work :-)

------------------------------------------------------------------------
[2014-02-28 08:20:07] hugh dot messenger at gmail dot com

Pretty please can someone take a look at this?  It's still making it almost impossible to
xdebug anything that involves MySQLi.

------------------------------------------------------------------------
[2014-02-28 03:34:05] exsysemchina at gmail dot com

Please fix this bug as soon as possible, otherwise debugging is painful with XDebug when fighting
with MYSQLi.

------------------------------------------------------------------------
[2013-07-19 12:35:16] suchy63 at hotmail dot com

I'm experiencing this problem as well, both in 5.4 and 5.5, and it's very problematic. It
makes it impossible for me to upgrade past 5.3. Our application has a custom error handler which
throws an exception if error is below the reporting level. I an unable to step over the code after a
breakpoint. The error handler is triggered and I am booted to the error page after an uncaught
exception.

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


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=63486


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


Thread (24 messages)

« previous php.bugs (#190862) next »