File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / dom / tests / bug44648.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:47:54 2012 UTC (12 years, 6 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

--TEST--
Bug #44648 (Attribute names not checked for wellformedness)
--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/>

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