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:
Try new test code, please. I will submit backtrace when I manage to
generate it.
Previous Comments:
------------------------------------------------------------------------
[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] [email protected]
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.
------------------------------------------------------------------------
[2011-04-21 08:29:44] an0nym at narod dot ru
There was a similar problem that was patched in PHP 5.3.6.
http://bugs.php.net/53551
------------------------------------------------------------------------
[2011-04-21 08:28:36] an0nym at narod dot ru
Description:
------------
PHP segfaults when prepared statement that threw an exception is
reexecuted. pdo_mysql, libmysql. Haven't tested with mysqlnd yet.
Test script:
---------------
<?php
$DB = new PDO("mysql:dbname=test;host=localhost", "root", "",
array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_EMULATE_PREPARES => false));
$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();
Expected result:
----------------
Script successfully executed
Actual result:
--------------
Segmentation fault
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=54583&edit=1