|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #80494 DOMElement::remove not documented
Submitted: 2020-12-08 11:19 UTC Modified: 2023-11-12 16:56 UTC
From: contact at perryrylance dot com Assigned: nielsdos (profile)
Status: Closed Package: DOM XML related
PHP Version: 8.0.0 OS: Windows 10
Private report: No CVE-ID: None
 [2020-12-08 11:19 UTC] contact at perryrylance dot com
I have a library which extends DOMElement.

My library adds DOMElement::remove for convenience.

After installing PHP 8 my library creates a fatal error.

The function definition I have for ExampleElement::remove does not match DOMElement::remove.

Not a biggie - I can simply change the function definition to match, *however*, the PHP manual does not document this function.

Test script:

class ExampleElement extends DOMElement
    public function remove()


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-12-08 11:28 UTC]
Right, this was part of the DOM Living Standard RFC

I haven't gotten around to the documentation part yet :-( The signature is without paraemters:

public function delete();
 [2020-12-08 11:28 UTC]
I am sorry, i meant:

public function remove();
 [2020-12-08 11:30 UTC]
Sorry, I am having a bad day, the problem is not the parameters, but that the PHP 8 api has "void" as return type, so my last attempt, this time its right :-)

public function remove(): void;

As a side-note, PHP 8 now contains so called stubs, that show the right signature directly in PHP code. See the DOM Extension and remove here:
 [2020-12-08 11:43 UTC] contact at perryrylance dot com
Wonderful, thank you so much!

Looks like I can simply remove this from my implementation :)

Thanks again!
 [2021-05-11 06:11 UTC] contact at perryrylance dot com
Hi Benjamin

I see that more methods have been added to DOMElement, which is great.

I'd like to bring my library up to date, drop support for PHP < 7.0.0 and add return types and matching function signatures to your implementation.

I do have one request - could I perhaps ask that the functions remove, before, after and friends could possibly return $this?

My library facilitates method chaining, changing some of these functions to return void could break older projects.

If this is at all possible I'd massively appreciate it.

Thank you.
 [2021-11-09 12:05 UTC]
-Status: Open +Status: Verified -Package: Documentation problem +Package: DOM XML related
 [2021-11-09 12:05 UTC]
> I do have one request - could I perhaps ask that the functions
> remove, before, after and friends could possibly return $this?

I think we should stick with the HTML standard, see
 [2023-11-12 16:56 UTC]
-Status: Verified +Status: Closed -Assigned To: +Assigned To: nielsdos
 [2023-11-12 16:56 UTC]
The fix for this bug has been committed.
If you are still experiencing this bug, try to check out latest source from and re-test.
Thank you for the report, and for helping us make PHP better.

Documented now
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jul 13 20:01:29 2024 UTC