php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22192 casefolding option should be off by default
Submitted: 2003-02-12 17:04 UTC Modified: 2003-02-13 08:49 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:0 of 0 (0.0%)
From: duerst at w3 dot org Assigned:
Status: Wont fix Package: XML related
PHP Version: 4.3.0 OS: Windows 2000
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: duerst at w3 dot org
New email:
PHP Version: OS:

 

 [2003-02-12 17:04 UTC] duerst at w3 dot org
The default setting for casefolding for element and attribute
names for standard PHP XML parsers (created with
xml_parser_create()) is set to ON (see
http://www.php.net/manual/en/ref.xml.php#xml.case-folding). Unfortunately, this is in strong contrast with the XML
Standard, which specifies that all element and attribute
names are case-sensitive
(i.e. <foo> and <FOO> are two completely different things).

Having to call
xml_parser_set_option ($xml_parser, XML_OPTION_CASE_FOLDING, FALSE);
every time is tedious. Forgetting it results in faulty
code (even if it may look like it works). This is very
much against the quick and straightforward way that
programmers have come to love and expect of PHP.

The default for case-folding should therefore be changed,
so that it is off. Even better would be to completely
disable this option in the PHP glue interfacing with expat.
Case-folding of element and attribute names and XML simply
don't belong together.

Changing defaults may not be done easily, so planning for
this should start as early as possible.

As a first step, it would also be very helpful to improve
the documentation. The documentation should very clearly
say that using xml_parser_set_option() after xml_parser_create() is necessary, and in all examples,
xml_parser_set_option() should actually be called.

Many thanks in advance for fixing this problem, and helping
with correct XML and easy PHP programming. Please contact
me if you need more information or have questions.

Regards,    Martin.


Some additional remarks:

The option is either a remnant of
SGML (the precursor of XML), or remained from the time
where "to case-fold or not to case-fold" was still under
consideration before XML got finalized (more than 5 years
ago).

Fortunately, the parser marks
"<foo>this is some text</FOO>" as illegal even if case-folding is set on, so the case-folding option only
affects values passed to the callbacks. But that's
bad enough.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-02-12 17:13 UTC] duerst at w3 dot org
changed 'OS' from 'Windows 2000' to 'all'
 [2003-02-12 18:32 UTC] sniper@php.net
You can change it within your script with  xml_parser_set_option(), as you most likely 
already know. But we can't change the default because
of backwards compatibility.


 [2003-02-13 08:49 UTC] duerst at w3 dot org
Thanks for your quick reply.
I asked for changing the default (which has some backwards
compatibility issue) and for improving the documentation
(which does not). Should I raise the documentation part
as a separate bug report?
As for the backwards compatibility issue, this does not mean
that it cannot be changed. It just requires more careful planning, i.e. tell people now that they should not rely on the default in the future, and change it with the next major version (e.g. 5.0). In the long term, everybody will win.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Fri Jan 17 18:01:24 2020 UTC