Compatibility Error
superpoincare opened this issue · 3 comments
superpoincare commented
I am trying to use this:
<?php
require_once 'vendor/autoload.php';
$document = new Gt\Dom\HTMLDocument("<!doctype html><h1>Hello, World!</h1>");
$h2 = $document->createElement("h2");
$h2->textContent = "Goodbye, World!";
$document->body->appendChild($h2);
echo $document;
But I get this error:
PS C:\Users\<username>\Downloads> php -f .\Untitled-2.php
PHP Fatal error: Declaration of Gt\Dom\Document::isEqualNode(Gt\Dom\Node|Gt\Dom\Element|DOMNode $otherNode): bool must be compatible with DOMNode::isEqualNode(?DOMNode $otherNode): bool in C:\Users\<username>\Downloads\vendor\phpgt\dom\src\Document.php on line 341
Windows 10/PHP 8.3
g105b commented
Hi @superpoincare please can you let me know what version of this library you are using?
superpoincare commented
{
"require": {
"phpgt/dom": "^4.1"
}
}
4.1 according to composer.json.
My bad. Somehow composer require didn't update to the latest version. But when I downloaded the repo and replaced the src folder, it started working. Should close the issue I guess.
g105b commented
Ah, that explains it. The latest release was made in order to fix this issue with the underlying libxml implementation, so I assumed there would be a version issue. Glad it's working fine for you now.
Feel free to ask any other questions you have here, I'm happy to help out where possible.