Project

General

Profile

Actions

Anomalie #1836

open

fatal error when generating Excel export (project) with some type of content !!!!

Added by Simon 1 day ago. Updated 1 day ago.

Status:
Nouveau
Priority:
Normal
Assignee:
Category:
admin
Target version:
Start date:
11/03/2025
Due date:
% Done:

0%

Estimated time:
2.00 h
Resolution:

Description

Fatal error: Uncaught Error: Call to a member function innertext() on null in /home/qwlwyqw/www/lib/vendor/simple_html_dom.php:2284 Stack trace: #0 /home/qwlwyqw/www/lib/comp-vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Helper/Html.php(624): simple_html_dom->__toString() #1 /home/qwlwyqw/www/export/excel/excel.report.inc.php(310): PhpOffice\PhpSpreadsheet\Helper\Html->toRichTextObject(Object(simple_html_dom)) #2 /home/qwlwyqw/www/export/excel/excel.report.inc.php(154): project_display_by_levels(Array, 7) #3 /home/qwlwyqw/www/export/excel/excel.report.inc.php(161): project_recursive(Array, 7) #4 /home/qwlwyqw/www/export/excel/main.php(234): project_recursive(Array, 7) #5 /home/qwlwyqw/www/export/report.php(65): require_once('/home/qwlwyqw/w...') #6 {main} thrown in /home/qwlwyqw/www/lib/vendor/simple_html_dom.php on line 2284

Actions #1

Updated by Simon 1 day ago · Edited

Bug is caused by cleanHTMLList() function but not by the following the loop... Very strange

if(count($ptags) === 1) {
                is_null($ptags[0]->innertext) ? $ptags[0]->outertext = '' : $ptags[0]->outertext = $ptags[0]->innertext;
            }

Even if DOM is not manipulated, it will returned the error after the following code :

<ul>
    <li data-end="1201" data-start="1127">
    <p data-end="1201" data-start="1129">Un <strong>suivi personnalisé</strong> par un conseiller en rénovation énergétique.</p>
    </li>
    <li data-end="1295" data-start="1202">
    <p data-end="1295" data-start="1204">Des <strong>conseils</strong> sur l’analyse de devis et l’identification des <strong>travaux prioritaires</strong>.</p>
    </li>
    <li data-end="1369" data-start="1296">
    <p data-end="1369" data-start="1298">Un <strong>accompagnement</strong> pour mobiliser les <strong>subventions disponibles</strong>.</p>
    </li>
</ul>

As a quick fix, function should be replaced by :

if(!function_exists('cleanHTMLList')) {

    function cleanHTMLList($content) {

        return $content;

    }

}
Actions

Also available in: Atom PDF