--TEST-- Renaming an attribute node to a name that already exists --EXTENSIONS-- dom --FILE-- ]> XML, LIBXML_DTDATTR); $root = $dom->documentElement; try { $root->attributes[0]->rename(NULL, 'c'); } catch (DOMException $e) { echo $e->getMessage(), "\n"; } try { $root->attributes[0]->rename(NULL, 'c'); } catch (DOMException $e) { echo $e->getMessage(), "\n"; } try { $root->attributes[1]->rename(NULL, 'a'); } catch (DOMException $e) { echo $e->getMessage(), "\n"; } try { $root->attributes[1]->rename('urn:a', 'foo'); } catch (DOMException $e) { echo $e->getMessage(), "\n"; } try { $root->attributes[3]->rename('', 'a'); } catch (DOMException $e) { echo $e->getMessage(), "\n"; } try { $root->firstElementChild->attributes[0]->rename(NULL, 'hello'); } catch (DOMException $e) { echo $e->getMessage(), "\n"; } try { $root->firstElementChild->attributes[1]->rename(NULL, 'my-attr'); } catch (DOMException $e) { echo $e->getMessage(), "\n"; } // This is here to validate that nothing actually changed echo $dom->saveXML(); ?> --EXPECT-- An attribute with the given name in the given namespace already exists An attribute with the given name in the given namespace already exists An attribute with the given name in the given namespace already exists An attribute with the given name in the given namespace already exists An attribute with the given name in the given namespace already exists An attribute with the given name in the given namespace already exists ]>