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

From: Date: Fri, 28 Feb 2014 08:20:08 +0000
Subject: Bug #63486 [Com]: 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-184469@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
 Comment by:         hugh dot messenger at gmail dot com
 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:

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


Previous Comments:
------------------------------------------------------------------------
[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.

------------------------------------------------------------------------
[2013-05-08 06:20:57] hugh dot messenger at gmail dot com

Just wondering if anyone has given this any thought recently?  It's been 
absolutely crippling my xdebug usage since upgrading to 5.4.14 a month ago.  I'd 
vote for including it in the next release of 5.4, given that as far as I can tell, 
most of the world is only just now starting to move from 5.3 to 5.4 as their 
minimum requirement / standard development version, so punting this till 5.5 is 
going to mean a long time for us work-a-day application developers having to deal 
with page upon page upon page of "can't fetch result" and "property access"

warnings on xdebug sessions.  Or at the very least, make it a notice instead of a 
warning.  My $0.02.

------------------------------------------------------------------------
[2013-01-30 12:56:09] dev at pp3345 dot net

Hello,

I've also experienced this bug in the past, using reflection on a freed resource. 
Are there any news on when the bug fix will be included in PHP? I think it 
wouldn't be a problem to include it in the next PHP 5.4/5.3 release since a ton of 
warnings isn't intended behavior. At least it should be in PHP 5.5.

------------------------------------------------------------------------
[2012-11-23 10:20:17] uw@php.net

Thanks for the patch. It seems straight forward , however, it changes behaviour in case of user
errors. This makes me wonder in which PHP version it should go.


Current behaviour:
a) var_dump() - the XDebug view 

res->free();
var_dump(res)  <-- throws a ton of warnings

b) Invalid property access - user error: why access free'd resource?

res->free();
var_dump(res->lengths) <--- throws a ton of warnings

c) Invalid method access - user error: why access free'd resource?

res->free();
res->free(); <--- trows a ton of warnings

In all three cases the user is confronted with warnings that he could ignore, if he wanted. The
patch leaves the user with:

a) var_dump() - the XDebug view

res->free()
var_dump(res) <-- Warning on accessing free'd resource is gone

b) 

res->free();
var_dump(res->lengths) <-- Notice
var_dump(res)          <-- Warning gone

In sum: user gets less hints about his, well, "why are you doing that"-code.

c)

res->free();
res->free();           <-- Fatal

Application that used to work now throws fatal



Please, note that I am not saying no to fixing the var_dump() issue. Trying to explain the side
effects of the proposed patch and asking what PHP version would qualify for such a change.

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


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 (#184469) next »