|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68512 DOMDocument specific properties in child class not used.
Submitted: 2014-11-27 08:20 UTC Modified: 2014-12-28 19:11 UTC
From: arjen at react dot com Assigned:
Status: Open Package: DOM XML related
PHP Version: 5.6.3 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.
Block user comment
Status: Assign to:
Bug Type:
From: arjen at react dot com
New email:
PHP Version: OS:


 [2014-11-27 08:20 UTC] arjen at react dot com
When extending DOMDocument, it's class properties cannot be overwritten/changed. DOMDocument's initial value are kept.

var_dump() however contains the actual new value, so behaviour is buggy at least.


Test script:

class A extends DOMDocument 
    public $formatOutput = true;
$a = new A;

var_dump($a->formatOutput); // false
var_dump($a); // Has formatOutput => true

Expected result:
object(A)#1 (34) {

Actual result:
object(A)#1 (34) {


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-12-28 19:08 UTC]
I'm inclined to say the var_dump output is what is incorrect. I believe DOMDocument's properties are read-only by design and should remain that way.
 [2014-12-28 19:11 UTC]
Further examination of the manual shows that some of DomDocument's properties are explicitly read-only while others are not. I am not sure what the exact reason for this is. Assuming that none of the properties are actually writable, I propose changing the docs to list that they are all read-only properties.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Mar 07 10:01:22 2021 UTC