|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #56354 get_object_vars() segfaults on extended class
Submitted: 2005-03-19 14:45 UTC Modified: 2005-03-20 19:57 UTC
From: Assigned: helly (profile)
Status: Closed Package: PDO (PECL)
PHP Version: PDO 0.3 OS: *
Private report: No CVE-ID: None
 [2005-03-19 14:45 UTC]
When extending PDO, and calling get_oject_vars($this) PHP segfaults. See reproduce script for test case.

Reproduce code:

class foo extends PDO {
    public $limit = null;
    function find()
        $vars = get_object_vars($this);

$foo = new foo('sqlite::memory:');

Expected result:
var_dump() of an array containing limit => null

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-03-19 16:35 UTC] schlueter at phpbar dot de
The problem is that PDO overrides the property handlers. 
dbh_get_properties() which is called by 
PHP_FUNCTION(get_object_vars) returns always NULL but 
expects a hash_table so it segfaults. 
The patch at 
fixes this problem but I doubt it is the right solution 
since I'm using code which was removed by Marcus in 
pdo_dbh.c version 1.66 with the commit message "Changing 
handler table definitively results in SEGVs" so I doubt 
reintroducing this code is good. 
I don't know wether a non-overloaded PDO class would have 
problems always using the default handlers since the 
property hash-table these work on is available...
 [2005-03-20 19:57 UTC]
This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on

In case this was a website problem, the change will show
up on the website in short time.
Thank you for the report, and for helping us make PECL better.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Apr 21 08:01:27 2024 UTC