php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38596 PHP segfaults on exit() with PDO prepared statements
Submitted: 2006-08-25 18:46 UTC Modified: 2006-08-26 10:49 UTC
From: mj@php.net Assigned:
Status: Not a bug Package: PDO related
PHP Version: 5.1.5 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: mj@php.net
New email:
PHP Version: OS:

 

 [2006-08-25 18:46 UTC] mj@php.net
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


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-08-25 19:07 UTC] mj@php.net
The problem also exists in PHP 5.2.0 RC1. The backtrace is identical except for different line numbers:

#0  0x40402927 in mysql_more_results () from /usr//lib/libmysqlclient.so.14
#1  0x0814bfb0 in free_statement (stmt=0x40793b54) at /home/martin/src/php-5.2.0RC1/ext/pdo/pdo_stmt.c:2225
#2  0x082fd939 in zend_objects_store_free_object_storage (objects=0x8477d78) at /home/martin/src/php-5.2.0RC1/Zend/zend_objects_API.c:86
#3  0x082d4193 in shutdown_executor () at /home/martin/src/php-5.2.0RC1/Zend/zend_execute_API.c:295
#4  0x082e1260 in zend_deactivate () at /home/martin/src/php-5.2.0RC1/Zend/zend.c:839
#5  0x0829c678 in php_request_shutdown (dummy=0x0) at /home/martin/src/php-5.2.0RC1/main/main.c:1300
#6  0x0835820e in main (argc=3, argv=0xbffffb64) at /home/martin/src/php-5.2.0RC1/sapi/cli/php_cli.c:1250
 [2006-08-25 20:45 UTC] pajoye@php.net
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-08-26 09:01 UTC] mj@php.net
The issue does *not* occur in php5.2-200608260630.
 [2006-08-26 10:49 UTC] pajoye@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

duplicate of #37445 (which is fixed)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 29 11:01:32 2024 UTC