php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #40567 DOMDocument->createElement()
Submitted: 2007-02-20 22:07 UTC Modified: 2007-02-22 10:53 UTC
From: bpipe at mail dot ru Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 5.2.1 OS:
Private report: No CVE-ID: None
 [2007-02-20 22:07 UTC] bpipe at mail dot ru
Description:
------------
DomDocument->CreateElement()
I have a feature request, i think you should add a waring or notice when someone is calling CreateElement with ':' in node name.

Like this one:
$xsl->createElement('xsl:import');
instead of CreateElementNS, because this problem is hard to detect (document look like it should when you output it)
I made this mistake myself and it took me 2 days to find out the problem, and only when i found the problem i managed to find any information about this in bugzilla.

A notice when you create XML node with ':' in name could save 2 days of my life )


Really very hard to detect this mistake, i was googling, sitting in IRC and asking everyone for 48 hours without any result. And i think I'm not alone who "stepped on this rake"



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-02-21 17:16 UTC] rrichards@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

element names are already validated and cause an error to be issued. The ":" char is a valid character in an element name
 [2007-02-22 08:28 UTC] bpipe at mail dot ru
"element names are already validated and cause an error to be issued. The
":" char is a valid character in an element name"
Yes ":" is valid character for element name, i'm not sayng that you shouldn't allow to use it i'm sayng that you should generate a notice about it, it;s lika casting float value to int value in C++ (cimpiler generate a notice about possible loss of data), same here, when user creates Element with ":" after document is saved the reslut will be not what he expect (this is lost of data) the part before ":" becomes NameSpace.
 [2007-02-22 08:32 UTC] bpipe at mail dot ru
I; not sayng this is bug, i marked this as feature request
 [2007-02-22 10:53 UTC] tony2001@php.net
>i'm not sayng that you shouldn't allow to use it i'm sayng 
>that you should generate a notice about it,

It's a valid character, so no notice would make sense.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 06:01:29 2024 UTC