Map DOMDocument::class to Gt\Dom\HTMLDocument::class#449
Map DOMDocument::class to Gt\Dom\HTMLDocument::class#449g105b merged 2 commits intophpgt:masterfrom szymanek-event-it:hotfix/class-map-document
Conversation
Fixes `DOMDocument::registerNodeClass(): Argument #2 ($extendedClass) must not be an abstract class` from change in PHP 8.1.26
|
Hi @szymanek-event-it , thanks for your contribution. I think this PR is correct, but the thing that I'm not sure about is how it works with |
Ensures DOMDocument is always mapped to the class that extends abstract Gt\Dom\Document
|
Hello @g105b, the DOMDocument could never have been initialized with the mapping to Gt\Dom\Document. This would have meant creating an instance of the abstract class Gt\Dom\Document. However, I changed the mapping to use static::class which points to the class extending Gt\Dom\Document to make this possible in the future. |
|
I see, thank you. I will give it a few test runs with some real-world applications I use the DOM heavily in and will get it merged by the end of the week 👍 |
|
Please create a release afterwards. The Lib currently crashes, because the php developers changed the DOMDocument::registerNodeClass() method to throw an error, if the name of an abstract class is passed into it. |
|
Will do! |
|
I've just checked a few projects and it all looks fine, but I've noticed that this bug was caused by updating PHP (both 8.1 and 8.2 are affected). It's a strange update to php-src, but I'm all for more type safety. I'll merge this in as soon as I can. |
|
Works really well, thank you for your contribution. I'll include this into a minor patch release now. |
Fixes
DOMDocument::registerNodeClass(): Argument #2 ($extendedClass) must not be an abstract classfrom change in PHP 8.1.26