|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #65182 Segmentation Fault by acces to class var in persitant mode
Submitted: 2013-07-02 10:24 UTC Modified: 2020-12-06 04:22 UTC
Avg. Score:4.6 ± 0.7
Reproduced:9 of 9 (100.0%)
Same Version:7 (77.8%)
Same OS:8 (88.9%)
From: radtke at hd-system dot de Assigned:
Status: No Feedback Package: PDO MySQL
PHP Version: 5.5.0 OS: Ubuntu 12.04
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2013-07-02 10:24 UTC] radtke at hd-system dot de
create a class which extends the pdo class f.e. "extPDO"
use the persistant mode 
declare a class var f.e. "$sf"
create more then 1 object of the extPDO class and
take access to the class var "$sf"
causes a segmentation fault

no seg fault if:

1. you are NOT in persistant mode
2. you just create 1 instance of the class
2. you don't declare the class var; just set it in the constructor and take access to it

Noticed by accessing two different databases in a loop.

Test script:
class extPDO extends PDO
 public $sf;
 public function  __construct($db_name, $host, $username, $passwd)
  $dsn = 'mysql:dbname='.$db_name.';host='.$host;
  $this->sf = '42';
  $options = array(PDO::ATTR_PERSISTENT => true);
  parent::__construct($dsn, $username, $passwd, $options);

function testExtPDO()
 for($i = 1; $i <= 2; $i++){
   $pdo_obj = new extPDO('csp2_mycms', 'csp2-db.pille.hds', 'root', '');
   $sql = 'SELECT user_id FROM user';
   $pdo_st = $pdo_obj->query($sql);
    if($row = $pdo_st->fetch(PDO::FETCH_ASSOC))
     echo $i.'.sf:'. $pdo_obj->sf."<br>";
  catch(Exception $e){
   echo 'Exception: '.$e->getMessage().'<br>';

Expected result:
no segmentation fault

Actual result:
segmentation fault


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2013-07-03 03:45 UTC]
-Status: Open +Status: Verified
 [2013-07-03 03:45 UTC]
I can reproduce, will look into it later
 [2013-09-20 09:54 UTC] radtke at hd-system dot de
What's the status of this bug? It's pretty bad to use non persistant mode in multi tier scenarios on enterprise environments.
 [2014-01-01 12:30 UTC]
-Package: PDO related +Package: PDO MySQL
 [2020-11-26 13:57 UTC]
-Status: Verified +Status: Feedback
 [2020-11-26 13:57 UTC]
I can't reproduce this, at least not on 7.3 upwards. If someone is still seeing this issue, please tell me.
 [2020-12-06 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Feb 25 05:01:26 2024 UTC