From: [EMAIL PROTECTED]
Operating system: Linux
PHP version: 5.1.5
PHP Bug Type: PDO related
Bug description: PHP segfaults on exit() with PDO prepared statements
Description:
------------
[Note: This bug is against PHP 5.1.6, but the bug interface only offers
5.1.5.]
The code below makes PHP segfault at the time that exit() is called. This
happens with both CLI and Apache 2 (prefork). I'm using MySQL 4.1.11.
If the return value of prepare() is not assigned to a variable, the script
does not crash. Also it does not crash when omitting the exit() call.
Reproduce code:
---------------
<?php
class SomeClass {
public function doSomething($id) {
$dsn = "mysql:host=localhost;dbname=weblog";
$db = new PDO($dsn, "weblog", "weblog");
$stm = $db->prepare("UPDATE entry SET id = ?");
exit();
}
}
$obj = new SomeClass;
$obj->doSomething(1);
Expected result:
----------------
No crash.
Actual result:
--------------
#0 0x4011c927 in mysql_more_results () from
/usr//lib/libmysqlclient.so.14
#1 0x08134329 in free_statement (stmt=0x84e351c) at
/home/martin/src/php-5.1.6/ext/pdo/pdo_stmt.c:2200
#2 0x082a2349 in zend_objects_store_free_object_storage
(objects=0x83f60dc) at
/home/martin/src/php-5.1.6/Zend/zend_objects_API.c:86
#3 0x0828062f in shutdown_executor () at
/home/martin/src/php-5.1.6/Zend/zend_execute_API.c:281
#4 0x0828b074 in zend_deactivate () at
/home/martin/src/php-5.1.6/Zend/zend.c:854
#5 0x082513b6 in php_request_shutdown (dummy=0x0) at
/home/martin/src/php-5.1.6/main/main.c:1292
#6 0x082f0cc0 in main (argc=3, argv=0xbffffb84) at
/home/martin/src/php-5.1.6/sapi/cli/php_cli.c:1246
--
Edit bug report at http://bugs.php.net/?id=38596&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=38596&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=38596&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=38596&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=38596&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=38596&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=38596&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=38596&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=38596&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=38596&r=support
Expected behavior: http://bugs.php.net/fix.php?id=38596&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=38596&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=38596&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=38596&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38596&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=38596&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=38596&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=38596&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=38596&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=38596&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=38596&r=mysqlcfg