Bug #80537 [NEW]: Wrong parameter type in DOMElement::removeAttributeNode stub
| From: | ondrej at mirtes dot cz | Date: | Mon, 21 Dec 2020 08:48:40 +0000 |
| Subject: | Bug #80537 [NEW]: Wrong parameter type in DOMElement::removeAttributeNode stub | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-231202@lists.php.net to get a copy of this message | ||
From: ondrej at mirtes dot cz
Operating system: N/A
PHP version: 8.0.0
Package: Reflection related
Bug Type: Bug
Bug description:Wrong parameter type in DOMElement::removeAttributeNode stub
Description:
------------
The stub for this method looks like this
(https://github.com/php/php-src/blob/4c5e47d113429773a885e78599e20cfe0490905b/ext/dom/php_dom.stub.php#L207-L208):
/** @return DOMAttr|false */
public function removeAttributeNode(string $qualifiedName) {}
But the method accepts DOMAttr: https://3v4l.org/dbST3
PHP documentation agrees:
https://www.php.net/manual/en/domelement.removeattributenode.php
Originally reported as PHPStan bug:
https://github.com/phpstan/phpstan/issues/4268
Test script:
---------------
<?php declare(strict_types = 1);
$document = new DOMDocument();
$document->loadXML('<x a="foo"/>');
/** @var DOMElement $element */
$element = $document->documentElement;
$attribute = $element->getAttributeNode('a');
$element->removeAttributeNode($attribute);
var_dump($document->saveHTML());
--
Edit bug report at https://bugs.php.net/bug.php?id=80537&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=80537&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=80537&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=80537&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=80537&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=80537&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=80537&r=support
Expected behavior: https://bugs.php.net/fix.php?id=80537&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=80537&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=80537&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=80537&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80537&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=80537&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=80537&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=80537&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=80537&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=80537&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=80537&r=mysqlcfg