Bug #68512 [Opn]: DOMDocument specific properties in child class not used.

From: Date: Sun, 28 Dec 2014 19:08:15 +0000
Subject: Bug #68512 [Opn]: DOMDocument specific properties in child class not used.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-189254@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68512&edit=1

 ID:                 68512
 Updated by:         levim@php.net
 Reported by:        arjen at react dot com
 Summary:            DOMDocument specific properties in child class not
                     used.
 Status:             Open
 Type:               Bug
 Package:            DOM XML related
 Operating System:   Linux
 PHP Version:        5.6.3
 Block user comment: N
 Private report:     N

 New Comment:

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.


Previous Comments:
------------------------------------------------------------------------
[2014-11-27 08:20:52] arjen at react dot com

Description:
------------
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.

See http://3v4l.org/6H88X

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

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

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

Expected result:
----------------
bool(true)
object(A)#1 (34) {
  ["formatOutput"]=>
  bool(true)
  <<cut>>
}

Actual result:
--------------
bool(false)
object(A)#1 (34) {
  ["formatOutput"]=>
  bool(true)
  <<cut>>
}


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=68512&edit=1


Thread (3 messages)

« previous php.bugs (#189254) next »