php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63910 var_dump() on DOMNode is like in PHP < 5.4.1
Submitted: 2013-01-05 15:01 UTC Modified: 2013-01-05 22:57 UTC
From: hanskrentel at yahoo dot de Assigned:
Status: Not a bug Package: DOM XML related
PHP Version: 5.4.10 OS: Win32 / XP
Private report: No CVE-ID: None
 [2013-01-05 15:01 UTC] hanskrentel at yahoo dot de
Description:
------------
If I want to make use of the improvements for DOMNodes with var_dump since PHP 
5.4.1 on my system, I can't. It's just like the old (not-so-much-saying) output 
like before 5.4.1.

It is like that if the changes of which are said that have been introduced in PHP 
5.4.1 (demo: http://3v4l.org/8HfO6 - Changelog named this feature for 5.3.11 
"Added debug info handler to DOM objects.") are just not there on my system.

Related: #48527 (You might want to close this for now)

Test script:
---------------
<?php
$DOMDocumentNode = new DOMDocument();
$DOMDocumentNode->loadXML('<example a="b">Test</example>');
$DOMElementNode   = $DOMDocumentNode->documentElement;
$DOMAttributeNode = $DOMElementNode->getAttributeNode('a');
$DOMTextNode      = $DOMElementNode->firstChild;

var_dump($DOMDocumentNode, $DOMElementNode, $DOMAttributeNode, $DOMTextNode);


Expected result:
----------------
object(DOMDocument)#1 (34) {
  ["doctype"]=>
  NULL
  ["implementation"]=>
  string(22) "(object value omitted)"
  ["documentElement"]=>
  string(22) "(object value omitted)"
  ["actualEncoding"]=>
  NULL
  ["encoding"]=>
  NULL
  ["xmlEncoding"]=>
  NULL
  ["standalone"]=>
  bool(true)
  ["xmlStandalone"]=>
  bool(true)
  ["version"]=>
  string(3) "1.0"
  ["xmlVersion"]=>
  string(3) "1.0"
  ["strictErrorChecking"]=>
  bool(true)
  ["documentURI"]=>
  string(1) "/"
  ["config"]=>
  NULL
  ["formatOutput"]=>
  bool(false)
  ["validateOnParse"]=>
  bool(false)
  ["resolveExternals"]=>
  bool(false)
  ["preserveWhiteSpace"]=>
  bool(true)
  ["recover"]=>
  bool(false)
  ["substituteEntities"]=>
  bool(false)
  ["nodeName"]=>
  string(9) "#document"
  ["nodeValue"]=>
  NULL
  ["nodeType"]=>
  int(9)
  ["parentNode"]=>
  NULL
  ["childNodes"]=>
  string(22) "(object value omitted)"
  ["firstChild"]=>
  string(22) "(object value omitted)"
  ["lastChild"]=>
  string(22) "(object value omitted)"
  ["previousSibling"]=>
  NULL
  ["attributes"]=>
  NULL
  ["ownerDocument"]=>
  NULL
  ["namespaceURI"]=>
  NULL
  ["prefix"]=>
  string(0) ""
  ["localName"]=>
  NULL
  ["baseURI"]=>
  string(1) "/"
  ["textContent"]=>
  string(4) "Test"
}
object(DOMElement)#2 (17) {
  ["tagName"]=>
  string(7) "example"
  ["schemaTypeInfo"]=>
  NULL
  ["nodeName"]=>
  string(7) "example"
  ["nodeValue"]=>
  string(4) "Test"
  ["nodeType"]=>
  int(1)
  ["parentNode"]=>
  string(22) "(object value omitted)"
  ["childNodes"]=>
  string(22) "(object value omitted)"
  ["firstChild"]=>
  string(22) "(object value omitted)"
  ["lastChild"]=>
  string(22) "(object value omitted)"
  ["previousSibling"]=>
  NULL
  ["attributes"]=>
  string(22) "(object value omitted)"
  ["ownerDocument"]=>
  string(22) "(object value omitted)"
  ["namespaceURI"]=>
  NULL
  ["prefix"]=>
  string(0) ""
  ["localName"]=>
  string(7) "example"
  ["baseURI"]=>
  string(1) "/"
  ["textContent"]=>
  string(4) "Test"
}

Warning: var_dump(): Not yet implemented in /in/MXnGG on line 18
object(DOMAttr)#3 (20) {
  ["name"]=>
  string(1) "a"
  ["specified"]=>
  bool(true)
  ["value"]=>
  string(1) "b"
  ["ownerElement"]=>
  string(22) "(object value omitted)"
  ["schemaTypeInfo"]=>
  NULL
  ["nodeName"]=>
  string(1) "a"
  ["nodeValue"]=>
  string(1) "b"
  ["nodeType"]=>
  int(2)
  ["parentNode"]=>
  string(22) "(object value omitted)"
  ["childNodes"]=>
  string(22) "(object value omitted)"
  ["firstChild"]=>
  string(22) "(object value omitted)"
  ["lastChild"]=>
  string(22) "(object value omitted)"
  ["previousSibling"]=>
  NULL
  ["attributes"]=>
  NULL
  ["ownerDocument"]=>
  string(22) "(object value omitted)"
  ["namespaceURI"]=>
  NULL
  ["prefix"]=>
  string(0) ""
  ["localName"]=>
  string(1) "a"
  ["baseURI"]=>
  string(1) "/"
  ["textContent"]=>
  string(1) "b"
}
object(DOMText)#4 (18) {
  ["wholeText"]=>
  string(4) "Test"
  ["data"]=>
  string(4) "Test"
  ["length"]=>
  int(4)
  ["nodeName"]=>
  string(5) "#text"
  ["nodeValue"]=>
  string(4) "Test"
  ["nodeType"]=>
  int(3)
  ["parentNode"]=>
  string(22) "(object value omitted)"
  ["childNodes"]=>
  NULL
  ["firstChild"]=>
  NULL
  ["lastChild"]=>
  NULL
  ["previousSibling"]=>
  NULL
  ["attributes"]=>
  NULL
  ["ownerDocument"]=>
  string(22) "(object value omitted)"
  ["namespaceURI"]=>
  NULL
  ["prefix"]=>
  string(0) ""
  ["localName"]=>
  NULL
  ["baseURI"]=>
  string(1) "/"
  ["textContent"]=>
  string(4) "Test"
}

Actual result:
--------------
class DOMDocument#1 (0) {
}
class DOMElement#2 (0) {
}
class DOMAttr#3 (0) {
}
class DOMText#4 (0) {
}

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-01-05 16:01 UTC] hanskrentel at yahoo dot de
Okay, I found out that my report is somewhat bogus.

I had xdebug enabled. Disabling xdebug did reveal the expected output.

[xdebug]
; zend_extension = c:\Programme\PHP-5.4\ext\php_xdebug-2.2.1-5.4-vc9-nts.dll
 [2013-01-05 21:25 UTC] hanskrentel at yahoo dot de
For reference: I create a ticket over at xdebug: http://bugs.xdebug.org/view.php?
id=913
 [2013-01-05 22:57 UTC] cataphract@php.net
-Status: Open +Status: Not a bug
 [2013-01-05 22:57 UTC] cataphract@php.net
Marking as bogus, as the problem is apparently in the Xdebug.
 [2018-07-11 17:50 UTC] chealer at gmail dot com
https://bugs.php.net/bug.php?id=76611 follows up on the lack of full inspection which persists in PHP 7.2.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 04:01:29 2024 UTC