php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80599 Docs are not updated
Submitted: 2021-01-06 19:11 UTC Modified: 2021-01-09 11:10 UTC
From: jules dot bernable at gmail dot com Assigned: cmb (profile)
Status: Closed Package: Systems problem
PHP Version: Irrelevant OS: debian
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jules dot bernable at gmail dot com
New email:
PHP Version: OS:

 

 [2021-01-06 19:11 UTC] jules dot bernable at gmail dot com
Description:
------------
In addition to https://bugs.php.net/bug.php?id=80537

The signature for the following methods :

* hasAttributeNS
* getAttributeNS
* setAttributeNS
* removeAttributeNS
* getAttributeNodeNS

Report their first argument as a nullable string. This is not what is documented and passing null as the first argument to these method do throw a TypeError.

Test script:
---------------
<?php declare(strict_types=1);

$el = new class('foo') extends DOMElement {
  public function hasAttributeNS(string $namespace , string $localName): bool {
    return true;
  }
};

$el = new class('foo') extends DOMElement {
  public function getAttributeNS(string $namespace , string $localName): string {
    return 'bar';
  }
};

$el = new class('foo') extends DOMElement {
  public function setAttributeNS(string $namespace, string $qualifiedName, string $value): void {}
};

// etc...

Actual result:
--------------
PHP Fatal error:  Declaration of DOMElement@anonymous::hasAttributeNS(string $namespaceURI, string $localName): bool must be compatible with DOMElement::hasAttributeNS(?string $namespace, string $localName) in ...

PHP Fatal error:  Declaration of DOMElement@anonymous::getAttributeNS(string $namespaceURI, string $localName): string must be compatible with DOMElement::getAttributeNS(?string $namespace, string $localName) in ...

PHP Fatal error:  Declaration of DOMElement@anonymous::setAttributeNS(string $namespace, string $qualifiedName, string $value): void must be compatible with DOMElement::setAttributeNS(?string $namespace, string $qualifiedName, string $value) in ...

// etc...

Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-01-06 23:39 UTC] cmb@php.net
-Summary: Wrong type signature for DOMElement methods +Summary: Docs are not updated -Status: Open +Status: Verified -Package: DOM XML related +Package: Systems problem -PHP Version: 8.0.0 +PHP Version: Irrelevant
 [2021-01-06 23:39 UTC] cmb@php.net
Calling these methods with null as first argument is supported[1],
and the docs have been already fixed[2]. However, they are
currently not rolled out to the main site[3].

[1] <https://3v4l.org/XsI0i>
[2] <http://docs.php.net/manual/en/domelement.getattributenodens.php>
[3] <https://github.com/php/systems/pull/13>
 [2021-01-06 23:39 UTC] cmb@php.net
The following pull request has been associated:

Patch Name: Fix rsync
On GitHub:  https://github.com/php/systems/pull/13
Patch:      https://github.com/php/systems/pull/13.patch
 [2021-01-09 11:10 UTC] cmb@php.net
-Status: Verified +Status: Closed -Assigned To: +Assigned To: cmb
 [2021-01-09 11:10 UTC] cmb@php.net
This issue has been resolved.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Mar 02 12:01:23 2021 UTC