php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39824 mysql_free_result warning
Submitted: 2006-12-13 23:20 UTC Modified: 2006-12-18 10:47 UTC
From: marcos dot neves at gmail dot com Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 5.2.0 OS: WINXP
Private report: No CVE-ID: None
 [2006-12-13 23:20 UTC] marcos dot neves at gmail dot com
Description:
------------
Starting with mysql 5.2.0, mysql_free_result is required be called before end of script

Reproduce code:
---------------
<?

mysql_connect("localhost", "root", "");

$result = mysql_query("SELECT 1 + 2");

?>

Expected result:
----------------
no warnings, the results should be disposed at end of script, as documentantion saids and as like was before.

Actual result:
--------------
Warning: Unknown: 1 result set(s) not freed. Use mysql_free_result to free result sets which were requested using mysql_query() in Unknown on line 0

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-12-18 08:38 UTC] tony2001@php.net
Set mysql.trace_mode to Off in your php.ini.
 [2006-12-18 10:38 UTC] marcos dot neves at gmail dot com
Hide the error msg doesn?t means the error has gone.
Does this error still happens before 5.2? Why no warning before?
The docs are very clear:
"only needs to be called if you are concerned about how much memory is being used for queries that return large result sets. All associated result memory is automatically freed at the end of the script's execution"

I hope that this "trick" of hide error messages to "fixes" then, not be used at PHP core code :(
 [2006-12-18 10:47 UTC] tony2001@php.net
>Does this error still happens before 5.2? 
Sure it does. 
Just enable trace_mode and you'll see it.

>Why no warning before?
Because you did not enable mysql.trace_mode before.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 10:01:28 2024 UTC