PMCORE-535 When using ampersands in output document the __ERROR__ variable is being set

This commit is contained in:
Roly Gutierrez
2022-01-26 11:54:39 -04:00
parent 42207cd5ba
commit 454582c1c8

View File

@@ -1,6 +1,7 @@
<?php <?php
use Illuminate\Filesystem\Filesystem; use Illuminate\Filesystem\Filesystem;
use Illuminate\Support\Facades\Log;
use ProcessMaker\Core\System; use ProcessMaker\Core\System;
class OutputDocument extends BaseOutputDocument class OutputDocument extends BaseOutputDocument
@@ -961,10 +962,16 @@ class OutputDocument extends BaseOutputDocument
} }
// Fix the HTML using DOMDocument class // Fix the HTML using DOMDocument class
libxml_use_internal_errors(true);
$doc = new DOMDocument('1.0', 'UTF-8'); $doc = new DOMDocument('1.0', 'UTF-8');
if ($content != '') { if ($content != '') {
$doc->loadHtml($content); $doc->loadHtml($content);
foreach (libxml_get_errors() as $error) {
$detail = (array) $error;
Log::channel(':OutputDocument::generateTcpdf')->warning('DOMDocument::loadHtml', Bootstrap::context($detail));
} }
}
libxml_clear_errors();
// Add a page and put the HTML fixed // Add a page and put the HTML fixed
$pdf->AddPage(); $pdf->AddPage();