Bug #81433 [NEW]: DOMElement::setIdAttribute(attr, true) called twice removes ID

From: Date: Mon, 13 Sep 2021 05:51:10 +0000
Subject: Bug #81433 [NEW]: DOMElement::setIdAttribute(attr, true) called twice removes ID
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-236554@lists.php.net to get a copy of this message
From: vv_volkov at mail dot ru Operating system: PHP version: 7.4.23 Package: DOM XML related Bug Type: Bug Bug description:DOMElement::setIdAttribute(attr, true) called twice removes ID Description: ------------ The method DOMElement::setIdAttribute(attr, true) works incorrectly. When called twice, it removes identity from the attribute. This pull request - https://github.com/php/php-src/pull/7482 - contains the bug fix Test script: --------------- $dom = new DOMDocument('1.0', 'utf-8'); $element = $dom->createElement('test', 'root'); $dom->appendChild($element); $element->setAttribute("id", 123); $element->setIdAttribute("id", true); $node = $element->getAttributeNode("id"); echo $node->isId(), "\n"; $element->setIdAttribute("id", true); echo $node->isId(), "\n"; Expected result: ---------------- The second call must not remove ID from the attribute Actual result: -------------- ID is removed from the attribute -- Edit bug report at https://bugs.php.net/bug.php?id=81433&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=81433&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=81433&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=81433&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=81433&r=needscript Try newer version: https://bugs.php.net/fix.php?id=81433&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=81433&r=support Expected behavior: https://bugs.php.net/fix.php?id=81433&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=81433&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=81433&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=81433&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=81433&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=81433&r=dst IIS Stability: https://bugs.php.net/fix.php?id=81433&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=81433&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=81433&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=81433&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=81433&r=mysqlcfg

« previous php.bugs (#236554) next »