Annotation of embedaddon/php/ext/dom/tests/bug44648.phpt, revision 1.1.1.2

1.1       misho       1: --TEST--
1.1.1.2 ! misho       2: Bug #44648 (Attribute names not checked for well formedness)
1.1       misho       3: --SKIPIF--
                      4: <?php require_once('skipif.inc'); ?>
                      5: --FILE--
                      6: <?php
                      7: 
                      8: $doc = new DOMDocument();
                      9: $doc->loadXML('<root/>');
                     10: 
                     11: $root = $doc->documentElement;
                     12: 
                     13: try {
                     14:   $attr = new DOMAttr('@acb', '123');
                     15:   $root->setAttributeNode($attr);
                     16: } catch (DOMException $e) {
                     17:   echo $e->getMessage()."\n";
                     18: }
                     19: 
                     20: try {
                     21:   $root->setAttribute('@def', '456');
                     22: } catch (DOMException $e) {
                     23:   echo $e->getMessage()."\n";
                     24: }
                     25: 
                     26: try {
                     27:   $root->setAttributeNS(NULL, '@ghi', '789');
                     28: } catch (DOMException $e) {
                     29:   echo $e->getMessage()."\n";
                     30: }
                     31: 
                     32: try {
                     33:   $root->setAttributeNS('urn::test', 'a:g@hi', '789');
                     34: } catch (DOMException $e) {
                     35:   echo $e->getMessage()."\n";
                     36: }
                     37: 
                     38: echo $doc->saveXML($root);
                     39: ?>
                     40: --EXPECT--
                     41: Invalid Character Error
                     42: Invalid Character Error
                     43: Invalid Character Error
                     44: Namespace Error
                     45: <root/>

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>