Bug #81682 [Com]: DocumentType nodes cannot be cloned nor imported

From: Date: Wed, 17 Aug 2022 05:25:28 +0000
Subject: Bug #81682 [Com]: DocumentType nodes cannot be cloned nor imported
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-242233@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81682&edit=1 ID: 81682 Comment by: prestigecitytownshipsarjapur at gmail dot com Reported by: jules dot bernable at gmail dot com Summary: DocumentType nodes cannot be cloned nor imported Status: Open Type: Bug Package: DOM XML related Operating System: irrelevant PHP Version: 8.1.0 Block user comment: N Private report: N New Comment: prestigecity.gen.in Previous Comments: ------------------------------------------------------------------------ [2021-12-01 08:01:54] jules dot bernable at gmail dot com Description: ------------ When trying to clone or import a doctype node, the operation always fail. AFAICT there's nothing in the DOM standard saying this should be the case (see https://dom.spec.whatwg.org/#dom-document-importnode). Test script: --------------- $original = new DOMDocument(); $original->loadHTML('<!DOCTYPE html>'); $docytpe = $original->doctype->cloneNode(); var_dump($doctype); // false $other = new DOMDocument(); $doctype = $other->importNode($original->doctype); var_dump($doctype); // false Expected result: ---------------- The result should be a new DocumentType node with the same name, publicId and systemId and, in the case of importNode, associated with the new document. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=81682&edit=1

« previous php.bugs (#242233) next »