summaryrefslogtreecommitdiff
path: root/ext/dom/tests/bug44648.phpt
blob: 4ff7ac389cbf67f68df8e094e299fb18bf0573df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
--TEST--
Bug #44648 (Attribute names not checked for well formedness)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php

$doc = new DOMDocument();
$doc->loadXML('<root/>');

$root = $doc->documentElement;

try {
  $attr = new DOMAttr('@acb', '123');
  $root->setAttributeNode($attr);
} catch (DOMException $e) {
  echo $e->getMessage()."\n";
}

try {
  $root->setAttribute('@def', '456');
} catch (DOMException $e) {
  echo $e->getMessage()."\n";
}

try {
  $root->setAttributeNS(NULL, '@ghi', '789');
} catch (DOMException $e) {
  echo $e->getMessage()."\n";
}

try {
  $root->setAttributeNS('urn::test', 'a:g@hi', '789');
} catch (DOMException $e) {
  echo $e->getMessage()."\n";
}

echo $doc->saveXML($root);
?>
--EXPECT--
Invalid Character Error
Invalid Character Error
Invalid Character Error
Namespace Error
<root/>