#42378 [Com]: bind_result memory exhaustion
| From: | uwendel at mysql dot com | Date: | Mon, 03 Sep 2007 14:52:13 +0000 |
| Subject: | #42378 [Com]: bind_result memory exhaustion | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-117049@lists.php.net to get a copy of this message | ||
ID: 42378
Comment by: uwendel at mysql dot com
Reported By: jullrich at sans dot org
Status: Assigned
Bug Type: MySQLi related
Operating System: Linux (CentOS 4.5)
PHP Version: 5.2.3
Assigned To: andrey
New Comment:
Can you add the table definition to the bug report?
Previous Comments:
------------------------------------------------------------------------
[2007-08-23 10:42:28] jani@php.net
Assigned to the Mysqli maintainer.
------------------------------------------------------------------------
[2007-08-22 11:44:28] jullrich at sans dot org
'cast' can be used as a workaround:
works: cast(format(trend,2) as char(10)))
does not work (same memory error): cast(format(trend,2) as char)
------------------------------------------------------------------------
[2007-08-22 11:33:14] jullrich at sans dot org
Description:
------------
The use of the mysql command "format" will lead to memory exhaustion on
bind_results. Here sample code that does cause the issue:
$sQuery="select targetport,format(trend,2) from trends where
current_targets>10 and trend is not null order by trend desc limit
100";
$oStmt=$oDB->prepare($sQuery);
$oStmt->execute();
$oStmt->store_result();
$oStmt->bind_result($nPort,$nTrend);
This code works fine if $sQuery is replaced with:
$sQuery="select targetport,trend from trends where current_targets>10
and trend is not null order by trend desc limit 100";
removing 'store_result' has no effect. Other changes to the SQL
statement have no effect either.
Error message logged:
PHP Fatal error: Allowed memory size of 83886080 bytes exhausted
(tried to allocate 1431655788 bytes) in query.html on line 4
Reproduce code:
---------------
$sQuery="select targetport,format(trend,2) from trends where
current_targets>10 and trend is not null order by trend desc limit
100";
$oStmt=$oDB->prepare($sQuery);
$oStmt->execute();
$oStmt->store_result();
$oStmt->bind_result($nPort,$nTrend);
Expected result:
----------------
I expected the query to "happen" and get executed.
Actual result:
--------------
PHP Fatal error: Allowed memory size of 83886080 bytes exhausted
(tried to allocate 1431655788 bytes) in query.html on line 4
(Line number corresponds to the 'bind_result' statement)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=42378&edit=1