php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #50362 documentation bug DOMAttr DOMNode
Submitted: 2009-12-02 19:09 UTC Modified: 2009-12-17 12:39 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: tlaguz at wp dot pl Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: 5.2.11 OS: Vista x64
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: tlaguz at wp dot pl
New email:
PHP Version: OS:

 

 [2009-12-02 19:09 UTC] tlaguz at wp dot pl
Description:
------------
Now:
DOMNode DOMNamedNodeMap::item ( int $index )

It should be:
DOMAttr DOMNamedNodeMap::item ( int $index )

My PHP returns that value (DOMAttr).

Reproduce code:
---------------
---
From manual page: domnamednodemap.item#Description
---



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-12-10 09:59 UTC] Dormilich at netscape dot net
according to the DOM (http://www.w3.org/TR/DOM-Level-2-Core/idl-definitions.html), DOMNamedNodeMap::item returns a DOMNode, which is the parent of DOMAttr.
 [2009-12-11 22:18 UTC] daniel dot egeberg at gmail dot com
That's the case in PHP as well.

daniel@daniel-laptop:~$ php -r "var_dump(is_subclass_of('DOMAttr', 'DOMNode'));"
bool(true)

which is also documented in the PHP manual:
http://php.net/manual/en/class.domattr.php
 [2009-12-17 12:39 UTC] seld@php.net
Thank you for reporting but in this case the documentation is correct, DOMAttr extends from DOMNode. In your case, item() returned a DOMAttr, but in other cases it might return another class (there are many) that extends from DOMNode, therefore changing the return value to DOMAttr wouldn't make sense.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Oct 08 03:00:02 2026 UTC