php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61292 Segfault while calling a method on an overloaded PDO object.
Submitted: 2012-03-05 16:58 UTC Modified: 2012-03-06 03:46 UTC
From: julien at palard dot fr Assigned: laruence
Status: Closed Package: PDO related
PHP Version: 5.4.0 OS: Linux 2.6.32-amd64
Private report: No CVE-ID:
 [2012-03-05 16:58 UTC] julien at palard dot fr
Description:
------------
Just check the simple code in the "Test script", it lead to the segfault.

Seems that it only segfault when ATTR_PERSISTENT is set.




Test script:
---------------
<?php

class Database_SQL extends PDO
{
    function __construct()
    {
        $options = array(PDO::ATTR_PERSISTENT => TRUE);
        parent::__construct("mysql:host=***;dbname=***;charset=utf8", '***', '***', $options);
    }

    var $bar = array();

    public function foo()
    {
        var_dump($this->bar);
    }
}

(new Melty_Database_SQL)->foo();

Expected result:
----------------
No segfault !

Actual result:
--------------
Segfault !

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-03-05 22:17 UTC] johannes@php.net
(gdb) bt
#0  0x084de050 in zend_std_read_property (object=0x893ebcc, member=0x893d558, 
    type=0, key=0x893d558)
    at branches/PHP_5_4/Zend/zend_object_handlers.c:433
#1  0x0857c5a9 in zend_fetch_property_address_read_helper_SPEC_UNUSED_CONST (
    execute_data=0x891f190)
    at branches/PHP_5_4/Zend/zend_vm_execute.h:21797
#2  0x0857c60e in ZEND_FETCH_OBJ_R_SPEC_UNUSED_CONST_HANDLER (
    execute_data=0x891f190)
    at branches/PHP_5_4/Zend/zend_vm_execute.h:21815
#3  0x084ea3bb in execute (op_array=0x893d428)
    at branches/PHP_5_4/Zend/zend_vm_execute.h:410
#4  0x084a29c2 in dtrace_execute (op_array=0x893d428)
    at branches/PHP_5_4/Zend/zend_dtrace.c:75
#5  0x084eb8d4 in zend_do_fcall_common_helper_SPEC (execute_data=0x891f0d4)
    at branches/PHP_5_4/Zend/zend_vm_execute.h:669
#6  0x084ec3df in ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER (execute_data=0x891f0d4)
    at branches/PHP_5_4/Zend/zend_vm_execute.h:752
#7  0x084ea3bb in execute (op_array=0x893b330)
    at branches/PHP_5_4/Zend/zend_vm_execute.h:410
#8  0x084a29c2 in dtrace_execute (op_array=0x893b330)
    at branches/PHP_5_4/Zend/zend_dtrace.c:75
#9  0x084b5d2d in zend_execute_scripts (type=8, retval=0x0, file_count=3)
    at branches/PHP_5_4/Zend/zend.c:1272
#10 0x0843e29a in php_execute_script (primary_file=0x80474b8)
    at branches/PHP_5_4/main/main.c:2473
#11 0x085ca879 in do_cli (argc=1, argv=0x8047804)
    at branches/PHP_5_4/sapi/cli/php_cli.c:983
#12 0x085cb8fb in main (argc=1, argv=0x8047804)
    at branches/PHP_5_4/sapi/cli/php_cli.c:1356
 [2012-03-05 22:17 UTC] johannes@php.net
-Status: Open +Status: Verified
 [2012-03-06 03:45 UTC] laruence@php.net
Automatic comment from SVN on behalf of laruence
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=323935
Log: Fixed bug #61292 (Segfault while calling a method on an overloaded PDO object)
 [2012-03-06 03:46 UTC] laruence@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 [2012-03-06 03:46 UTC] laruence@php.net
-Status: Verified +Status: Closed -Assigned To: +Assigned To: laruence
 [2012-03-06 06:24 UTC] laruence@php.net
Automatic comment from SVN on behalf of laruence
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=323936
Log: Add test for bug #61292, bug was fixed in -r323935
 [2012-04-18 09:45 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=1a1a8242c42d13b6fdd8d30233022db3a53419c4
Log: Fixed bug #61292 (Segfault while calling a method on an overloaded PDO object)
 [2012-07-24 23:36 UTC] rasmus@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=1a1a8242c42d13b6fdd8d30233022db3a53419c4
Log: Fixed bug #61292 (Segfault while calling a method on an overloaded PDO object)
 [2013-11-17 09:33 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=1a1a8242c42d13b6fdd8d30233022db3a53419c4
Log: Fixed bug #61292 (Segfault while calling a method on an overloaded PDO object)
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Fri Apr 18 05:03:21 2014 UTC