I've updated my drupal environment php 7.4 to php 8.1.18. i've enable some extensions, but I have this error when i try to download a PDF
Error : Typed property DOMDocument::$documentElement must not be accessed before initialization in Masterminds\HTML5\Parser\DOMTreeBuilder->startTag() (/var/www/myproject/vendor/masterminds/html5/src/HTML5/Parser/DOMTreeBuilder.php line 275)
#0 /var/www/myproject/vendor/masterminds/html5/src/HTML5/Parser/Tokenizer.php(399): Masterminds\HTML5\Parser\DOMTreeBuilder->startTag()
#1 /var/www/myproject/vendor/masterminds/html5/src/HTML5/Parser/Tokenizer.php(141): Masterminds\HTML5\Parser\Tokenizer->tagName()
#2 /var/www/myproject/vendor/masterminds/html5/src/HTML5/Parser/Tokenizer.php(82): Masterminds\HTML5\Parser\Tokenizer->consumeData()
#3 /var/www/myproject/vendor/masterminds/html5/src/HTML5.php(161): Masterminds\HTML5\Parser\Tokenizer->parse()
#4 /var/www/myproject/vendor/masterminds/html5/src/HTML5.php(89): Masterminds\HTML5->parse()
#5 /var/www/myproject/vendor/dompdf/dompdf/src/Dompdf.php(478): Masterminds\HTML5->loadHTML()
#6 /var/www/myproject/web/modules/contrib/entity_print/src/Plugin/EntityPrint/PrintEngine/DomPdf.php(207): Dompdf\Dompdf->loadHtml()
the extensions are the same than PHP7.4
EDIT :
By digging, I've found that this on
is producing this on php7
but this in php8 (going through the same functions)...
The nodeName
is just name
in php 8 (and so on). Do I have to change another thing in my server to update the \DOMImplementation() ?
EDIT 2 :
i've remade the delivry of my package to another server (so php7.4 to php8.1.13), same result. It only works into my docker container, not my client server. Here's my procedure :
apt install php8.1-fpm php8.1-xml php8.1-mysql php8.1-gd php8.1-cli php8.1-common php8.1-mbstring php8.1-opcache php8.1-readline php8.1-curl php8.1-bcmath php8.1-zip
I. edit ini file : /etc/php/8.1/fpm/php.ini
extension=gd
extension=zip
extension=dom
extension=pdo_mysql
extension=mbstring
II. Restart PHP/Nginx
sudo systemctl restart php8.1-fpm
sudo systemctl restart nginx
sudo update-alternatives --set php /usr/bin/php8.1