Edit report at http://bugs.php.net/bug.php?id=54583&edit=1
ID: 54583 User updated by: an0nym at narod dot ru Reported by: an0nym at narod dot ru Summary: Segfault when trying to reexecute statement after exception with libmysql -Status: Feedback +Status: Open Type: Bug Package: PDO related Operating System: CentOS 5.5 x86_64 PHP Version: 5.3.6 Block user comment: N Private report: N New Comment: Sorry, CentOS is with mysqlnd now. Testing on Fedora: root@test # uname -a Linux test 2.6.35.11-83.fc14.x86_64 #1 SMP Mon Feb 7 07:06:44 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux 06:32:59 ~ root@test # php -v PHP 5.3.6 (cli) (built: Mar 17 2011 20:56:13) Copyright (c) 1997-2011 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies 06:33:02 ~ root@test # find / | grep libmysql /usr/lib64/mysql/libmysqlclient.so.16.0.0 /usr/lib64/mysql/libmysqlclient_r.so.16.0.0 /usr/lib64/mysql/libmysqlclient_r.so.16 /usr/lib64/mysql/libmysqlclient.so.16 06:33:06 ~ root@test # cat test.php <?php var_dump(function_exists("mysqli_fetch_all")); $DB = new PDO("mysql:dbname=test;host=localhost", "root", "", array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_EMULATE_PREPARES => false, PDO::MYSQL_ATTR_INIT_COMMAND => "SET SQL_MODE = 'STRICT_ALL_TABLES'")); $DB->exec("CREATE TEMPORARY TABLE t(f VARCHAR(1))"); $stmt = $DB->prepare("INSERT INTO t VALUES(:value)"); $value = "aa"; $stmt->bindParam(":value", $value); try { $stmt->execute(); } catch (PDOException $e) {} $stmt->execute(); 06:33:17 ~ root@test # php test.php bool(false) Segmentation fault 06:33:24 ~ root@test # mysql -uroot Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 5 Server version: 5.1.56 Source distribution Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to modify and redistribute it under the GPL v2 license Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> exit Bye 06:34:43 ~ root@test # Previous Comments: ------------------------------------------------------------------------ [2011-05-10 10:15:36] u...@php.net Which version of libmysql is used, what's the server version? ------------------------------------------------------------------------ [2011-04-22 17:23:13] an0nym at narod dot ru Everything works fine with php5.3.5 + mysqlnd @ winsrv2008r2x64. So it seems that the error is with libmysql only. ------------------------------------------------------------------------ [2011-04-21 11:56:55] an0nym at narod dot ru Try new test code, please. I will submit backtrace when I manage to generate it. ------------------------------------------------------------------------ [2011-04-21 11:54:42] an0nym at narod dot ru It seems you don't have strict mode enabled. Try this. <?php $DB = new PDO("mysql:dbname=test;host=localhost", "root", "", array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_EMULATE_PREPARES => false, PDO::MYSQL_ATTR_INIT_COMMAND => "SET SQL_MODE = 'STRICT_ALL_TABLES'")); $DB->exec("CREATE TEMPORARY TABLE t(f VARCHAR(1))"); $stmt = $DB->prepare("INSERT INTO t VALUES(:value)"); $value = "aa"; $stmt->bindParam(":value", $value); try { $stmt->execute(); } catch (PDOException $e) {} $stmt->execute(); ------------------------------------------------------------------------ [2011-04-21 11:28:22] johan...@php.net Thank you for this bug report. To properly diagnose the problem, we need a backtrace to see what is happening behind the scenes. To find out how to generate a backtrace, please read http://bugs.php.net/bugs-generating-backtrace.php for *NIX and http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32 Once you have generated a backtrace, please submit it to this bug report and change the status back to "Open". Thank you for helping us make PHP better. Works for me with libmysql and mysqlnd. Please provide a stacktrace and the version of libmysql you are using. ------------------------------------------------------------------------ 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=54583 -- Edit this bug report at http://bugs.php.net/bug.php?id=54583&edit=1