From: kulakov74 at yandex dot ru
Operating system: Linux / Windows
PHP version: 5.2.3
PHP Bug Type: MySQL related
Bug description: mysql_free_result does not free result for a referenced
result variable
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 bug report at http://bugs.php.net/?id=41871&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=41871&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=41871&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=41871&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=41871&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=41871&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=41871&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=41871&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=41871&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=41871&r=support
Expected behavior: http://bugs.php.net/fix.php?id=41871&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=41871&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=41871&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=41871&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41871&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=41871&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=41871&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=41871&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=41871&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=41871&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=41871&r=mysqlcfg