ID:               41871
 Updated by:       [EMAIL PROTECTED]
 Reported By:      kulakov74 at yandex dot ru
-Status:           Open
+Status:           Bogus
 Bug Type:         MySQL related
 Operating System: Linux / Windows
 PHP Version:      5.2.3
 New Comment:

This is expected result. mysql_free_result() just decreases the
refcount to the result and actual freeing happens during request
shutdown (if refcount to the result is 0!).


Previous Comments:
------------------------------------------------------------------------

[2007-07-02 13:12:53] kulakov74 at yandex dot ru

Description:
------------
When I call mysql_free_result($Res) I expect I won't be able to use the
result in calls to mysql_fetch_array() etc. But if $Res is passed by
reference as a function parameter and is copied to another variable the
result is not freed and I can still use it. 

I realize this is a VERY unlikely condition and I found it by accident
(mixed 2 lines of code and got surprised to see no error). Also this
might well be intentional behavior. Anyway, just in case. 

Reproduce code:
---------------
a($Res);

function a(&$Res){
$Res=mysql_query("Show Tables"); $Res1=$Res;
mysql_free_result($Res);
mysql_fetch_array($Res); //still works!
}

Expected result:
----------------
Warning: mysql_fetch_array(): 7 is not a valid MySQL result resource in

Actual result:
--------------
No errors


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


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

Reply via email to