#37621 [Fbk->Opn]: bind_param goes out of memory with wrong arguments
| From: | michal at logix dot cz | Date: | Tue, 30 May 2006 00:00:51 +0000 |
| Subject: | #37621 [Fbk->Opn]: bind_param goes out of memory with wrong arguments | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-97771@lists.php.net to get a copy of this message | ||
ID: 37621
User updated by: michal at logix dot cz
Reported By: michal at logix dot cz
-Status: Feedback
+Status: Open
Bug Type: MySQLi related
Operating System: Linux
PHP Version: 5.1.4
Assigned To: georg
New Comment:
Cool, gives me a warning now: "Warning: mysqli_stmt::bind_param()
[function.mysqli-stmt-bind-param]: Number of elements in type
definition string doesn't match number of bind variables in
/.../server-mgr.php on line 175"
Thanks for the fix!
Previous Comments:
------------------------------------------------------------------------
[2006-05-29 17:02:04] mike@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5.2-win32-latest.zip
------------------------------------------------------------------------
[2006-05-29 01:52:26] michal at logix dot cz
Description:
------------
When using MySQLi->bind_param() I noticed it will go out of memory when
supplied with wrong arguments, e.g.:
$db->bind_param("sss", $param1, $param2);
Note there are three 's' but only two parameters. This line never
returns in my script and instead the httpd process dies with OOM. Once
deleted one of the 's' it plays well again.
Using Apache 2.0.58, PHP 5.1.4 and MySQL 4.1.10a on SUSE Linux 9.3/x86.
Reproduce code:
---------------
$query = "SELECT cookie FROM cookies ".
"WHERE username = ? AND sessionid = ? ".
"AND expiration > NOW() ORDER BY expiration DESC ".
"LIMIT 1";
$stmt = $db->prepare($query);
$stmt->bind_param("sss", $username, $sessionid);
[...]
Expected result:
----------------
Fail gracefully.
Actual result:
--------------
Goes out of memory, killing httpd thread.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=37621&edit=1