Edit report at http://bugs.php.net/bug.php?id=53551&edit=1
ID: 53551 Updated by: u...@php.net Reported by: eddawley at gmail dot com Summary: PDOStatement execute segfaults for pdo_mysql driver -Status: Assigned +Status: Closed Type: Bug Package: PDO related Operating System: Centos 5 PHP Version: 5.3.4 Assigned To: mysql Block user comment: N Private report: N New Comment: See SVN note Previous Comments: ------------------------------------------------------------------------ [2011-01-14 15:57:59] johan...@php.net Automatic comment from SVN on behalf of johannes Revision: http://svn.php.net/viewvc/?view=revision&revision=307478 Log: - Fix #53551 (PDOStatement execute segfaults for pdo_mysql driver) ------------------------------------------------------------------------ [2011-01-06 12:03:48] u...@php.net That fix should do it, however, I'd like to wait until Johannes returns from vacation and reviews it. PDO is a bit of a beast. With the fix the code should neither crash nor leak, nor behave differently from PDO_SQlite. Anyway, the result is still pretty, well, PDOish weird: error codes not cleaned up properly upon rebinding. Not my cup of coffee... Index: ext/pdo_mysql/mysql_statement.c =================================================================== --- ext/pdo_mysql/mysql_statement.c (Revision 307155) +++ ext/pdo_mysql/mysql_statement.c (Arbeitskopie) @@ -141,10 +141,12 @@ /* (re)bind the parameters */ if (mysql_stmt_bind_param(S->stmt, S->params) || mysql_stmt_execute(S->stmt)) { + /* if (S->params) { efree(S->params); S->params = 0; } + */ pdo_mysql_error_stmt(stmt); if (mysql_stmt_errno(S->stmt) == 2057) { /* CR_NEW_STMT_METADATA makes the statement unusable */ ------------------------------------------------------------------------ [2010-12-17 20:58:27] eddawley at gmail dot com Sorry, I didn't realize I was being unclear. The segfault is occurring with PDO using libmysql. Here are my relevant configure options: '--with-mysql=mysqlnd' '--with-mysqli' '--with-pdo-mysql' ------------------------------------------------------------------------ [2010-12-17 20:44:00] ka...@php.net MySQLnd is not a driver, its a library backend. MySQL, MySQLi and PDO_MySQL can all be powered by either libmysql or mysqlnd. So what you are saying is that you built pdo_mysql against libmysql which segfaults? ------------------------------------------------------------------------ [2010-12-17 19:38:02] eddawley at gmail dot com I would like to add that this happens for other mysql-level errors. For example, the following will also cause a segfault when reused: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails ... SQLSTATE[22003]: Numeric value out of range: 1264 Out of range value for column... And again, this was noticed with the pdo_mysql driver. NOT the mysqlnd native driver. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/bug.php?id=53551 -- Edit this bug report at http://bugs.php.net/bug.php?id=53551&edit=1