-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix XML serializer errata: xmlns="" serialization should be allowed
The spec doesn't want to serialize xmlns:foo="", but the description of the step that checks this does not take into account that xmlns="" must be allowed. This patch corrects this errata. Closes GH-15894.
- Loading branch information
Showing
3 changed files
with
39 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--TEST-- | ||
XML serializer spec errata: xmlns="" serialization should be allowed | ||
--EXTENSIONS-- | ||
dom | ||
--FILE-- | ||
<?php | ||
|
||
// Should be allowed | ||
$dom = Dom\XMLDocument::createFromString('<root><x xmlns=""/></root>'); | ||
var_dump($dom->documentElement->innerHTML); | ||
|
||
// Should not be allowed | ||
$dom = Dom\XMLDocument::createFromString('<root><x/></root>'); | ||
$x = $dom->documentElement->firstChild; | ||
$x->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:a', ''); | ||
try { | ||
var_dump($dom->documentElement->innerHTML); | ||
} catch (DOMException $e) { | ||
echo $e->getMessage(), "\n"; | ||
} | ||
|
||
?> | ||
--EXPECT-- | ||
string(13) "<x xmlns=""/>" | ||
The resulting XML serialization is not well-formed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters