php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #42141 DOM getNamedItem() case-issue
Submitted: 2007-07-29 16:08 UTC Modified: 2007-07-29 21:10 UTC
From: linus dot martensson at elplan-gm dot se Assigned:
Status: Wont fix Package: Feature/Change Request
PHP Version: 5.2.3 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: linus dot martensson at elplan-gm dot se
New email:
PHP Version: OS:

 

 [2007-07-29 16:08 UTC] linus dot martensson at elplan-gm dot se
Description:
------------
DOMNamedNodeMap->getNamedItem() is case-sensitive, the ability to change this would be useful in templating systems. Add a second parameter for case-sensitive?

Reproduce code:
---------------
$xml = new DOMDocument();
$xml->loadXML('<html><head><!--yadayada--></head><body><div Id="testid"></div></body></html>');
$element = $xml->getElementById('testid');
echo $element->attributes->getNamedItem('id');

Expected result:
----------------
should echo "testid", the name of the element retrieved.

Actual result:
--------------
Echoes nothing, as the 'Id' in the xml is spelt with a capital I.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-07-29 16:15 UTC] derick@php.net
XML is case-sensitive... you'll just have to deal with this in your scripts.
 [2007-07-29 21:10 UTC] linus dot martensson at elplan-gm dot se
I see... Oh well, a suggestion is a suggestion, I just thought it'd match up better with all the other PHP functions that support both modes. 
Thanks anyways. =]
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 01 21:01:35 2025 UTC