#37621 [Fbk->Opn]: bind_param goes out of memory with wrong arguments
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] [EMAIL PROTECTED] 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
#37621 [NEW]: bind_param goes out of memory with wrong arguments
From: michal at logix dot cz Operating system: Linux PHP version: 5.1.4 PHP Bug Type: MySQLi related Bug description: bind_param goes out of memory with wrong arguments 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 bug report at http://bugs.php.net/?id=37621&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=37621&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=37621&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=37621&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=37621&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=37621&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=37621&r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=37621&r=needscript Try newer version:http://bugs.php.net/fix.php?id=37621&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=37621&r=support Expected behavior:http://bugs.php.net/fix.php?id=37621&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=37621&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=37621&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=37621&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=37621&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=37621&r=dst IIS Stability:http://bugs.php.net/fix.php?id=37621&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=37621&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=37621&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=37621&r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=37621&r=mysqlcfg
#28061 [NEW]: Apache crashes upon SIGHUP when PHP module is loaded
From: michal at logix dot cz Operating system: Linux, glibc 2.3.2 PHP version: 4CVS-2004-04-19 (stable) PHP Bug Type: Apache2 related Bug description: Apache crashes upon SIGHUP when PHP module is loaded Description: Apache 2.0.49 and PHP 4.3.6 (as well as lates CVS snapshot). When everything is up and running I remove one of the Apache's logfiles (e.g. ~www/logs/access_log) and tell Apache to recreate it by calling "killall -HUP httpd". Apache immediately crashes with the following in error_log: [Mon Apr 19 15:26:08 2004] [notice] SIGHUP received. Attempting to restart [Mon Apr 19 15:26:08 2004] [notice] seg fault or similar nasty error detected in the parent process When I disable loading of the PHP module in httpd.conf everything works just fine. When I downgrade to PHP 4.3.4 it works as well. Reproduce code: --- Compile Apache 2.0.49 with ./configure --prefix=/home/www --enable-http \ --enable-so --enable-usertrack and PHP 4.3.6 with: ./configure --prefix=/home/www/php \ --with-apxs2=/home/www/bin/apxs Install and run. Make any request, remove ~www/logs/access_log and run 'killall -HUP httpd' Expected result: access_log should be recreated Actual result: -- This appears in the error_log: [Mon Apr 19 15:26:08 2004] [notice] SIGHUP received. Attempting to restart [Mon Apr 19 15:26:08 2004] [notice] seg fault or similar nasty error detected in the parent process -- Edit bug report at http://bugs.php.net/?id=28061&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=28061&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=28061&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=28061&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=28061&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=28061&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=28061&r=needscript Try newer version: http://bugs.php.net/fix.php?id=28061&r=oldversion Not developer issue:http://bugs.php.net/fix.php?id=28061&r=support Expected behavior: http://bugs.php.net/fix.php?id=28061&r=notwrong Not enough info:http://bugs.php.net/fix.php?id=28061&r=notenoughinfo Submitted twice:http://bugs.php.net/fix.php?id=28061&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=28061&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28061&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=28061&r=dst IIS Stability: http://bugs.php.net/fix.php?id=28061&r=isapi Install GNU Sed:http://bugs.php.net/fix.php?id=28061&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=28061&r=float