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

 ID:                 61858
 Comment by:         arjen at react dot com
 Reported by:        sala...@php.net
 Summary:            DOMAttr debug info generates E_WARNING
 Status:             Open
 Type:               Bug
 Package:            DOM XML related
 PHP Version:        5.4.1
 Block user comment: N
 Private report:     N

 New Comment:

In  5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.10, 5.4.0 not 
warning was generated, while both objects were printed as if the are empty.

In 5.3.11 - 5.3.13, 5.4.1 - 5.4.3 the content IS printed, AND a warning is 
generated.

http://3v4l.org/OcEGX


Previous Comments:
------------------------------------------------------------------------
[2012-04-26 13:48:18] sala...@php.net

Description:
------------
Trying var_dump()/print_r() a DOMAttr prints an E_WARNING message "Not yet 
implemented".

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

$doc = new DOMDocument();
$doc->loadXML('<example a="b">Test</example>');

$example = $doc->getElementsByTagName('example')->item(0);
$attr    = $example->getAttributeNode('a');

var_dump($attr);
print_r($attr);


Expected result:
----------------
object(DOMAttr)#2 (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"
}
DOMAttr Object
(
    [name] => a
    [specified] => 1
    [value] => b
    [ownerElement] => (object value omitted)
    [schemaTypeInfo] => 
    [nodeName] => a
    [nodeValue] => b
    [nodeType] => 2
    [parentNode] => (object value omitted)
    [childNodes] => (object value omitted)
    [firstChild] => (object value omitted)
    [lastChild] => (object value omitted)
    [previousSibling] => 
    [attributes] => 
    [ownerDocument] => (object value omitted)
    [namespaceURI] => 
    [prefix] => 
    [localName] => a
    [baseURI] => /
    [textContent] => b
)


Actual result:
--------------
Warning: var_dump(): Not yet implemented in /tmp/php-OE78FO on line 9
object(DOMAttr)#2 (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"
}
DOMAttr Object

Warning: print_r(): Not yet implemented in /tmp/php-OE78FO on line 10
(
    [name] => a
    [specified] => 1
    [value] => b
    [ownerElement] => (object value omitted)
    [schemaTypeInfo] => 
    [nodeName] => a
    [nodeValue] => b
    [nodeType] => 2
    [parentNode] => (object value omitted)
    [childNodes] => (object value omitted)
    [firstChild] => (object value omitted)
    [lastChild] => (object value omitted)
    [previousSibling] => 
    [attributes] => 
    [ownerDocument] => (object value omitted)
    [namespaceURI] => 
    [prefix] => 
    [localName] => a
    [baseURI] => /
    [textContent] => b
)



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



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

Reply via email to