php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61858 DOMAttr debug info generates E_WARNING
Submitted: 2012-04-26 13:48 UTC Modified: 2013-12-02 14:57 UTC
Votes:22
Avg. Score:4.0 ± 1.0
Reproduced:20 of 20 (100.0%)
Same Version:6 (30.0%)
Same OS:2 (10.0%)
From: salathe@php.net Assigned:
Status: Closed Package: DOM XML related
PHP Version: 5.4.1 OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: salathe@php.net
New email:
PHP Version: OS:

 

 [2012-04-26 13:48 UTC] salathe@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
)


Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-05-25 12:08 UTC] arjen at react dot com
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
 [2013-12-02 14:57 UTC] mike@php.net
-Status: Open +Status: Verified
 [2013-12-02 14:57 UTC] mike@php.net
It tries to fetch DomAttr->schemaTypeInfo (DOM3) which results in the "not implemented" warning.
 [2016-12-07 17:46 UTC] obeobe at zoho dot com
This issue happens when doing something as simple as:

$attribute = $element->getAttributeNode($attributeName);

Still not fixed in PHP 5.6.

In PHP 7 the behavior is a little different - I don't see an actual warning but it kills xdebug (tracing a couple of line after calling a function that would throw an E_WARNING in PHP 5.6 causes the trace to immediately exit the current function and go back to the parent stack frame).

Unless I find a way to work around this - I won't be able to work with DOMDocument.

How come it wasn't fixed for more than 4 years?? It seems pretty trivial as it's just debugging code!
 [2017-01-10 22:25 UTC] nikic@php.net
Automatic comment on behalf of arnoutboks@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=07340553a562db2387c9995dce0c84dd9afba97e
Log: Fixed bug #61858 (DOMAttr debug info generates E_WARNING)
 [2017-01-10 22:25 UTC] nikic@php.net
-Status: Verified +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Nov 23 02:01:31 2024 UTC