Merge pull request #4665 from beganovich/v5-fix-ampersand

(v5) Fixes for ampersand not loading correctly (causing 500)
This commit is contained in:
Benjamin Beganović 2021-01-11 13:36:09 +01:00 committed by GitHub
commit 9c581f4b4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 8 deletions

View File

@ -111,7 +111,7 @@ trait PdfMakerUtilities
{ {
foreach ($children as $child) { foreach ($children as $child) {
$contains_html = false; $contains_html = false;
if (isset($child['content'])) { if (isset($child['content'])) {
$child['content'] = nl2br($child['content']); $child['content'] = nl2br($child['content']);
} }
@ -137,7 +137,10 @@ trait PdfMakerUtilities
$_child = $this->document->createElement($child['element'], ''); $_child = $this->document->createElement($child['element'], '');
$fragment = $this->document->createDocumentFragment(); $fragment = $this->document->createDocumentFragment();
$fragment->appendXML($child['content']);
$fragment->appendXML(
strtr($child['content'], ['&' => '&'])
);
$_child->appendChild($fragment); $_child->appendChild($fragment);
} else { } else {

12
composer.lock generated
View File

@ -206,16 +206,16 @@
}, },
{ {
"name": "beganovich/snappdf", "name": "beganovich/snappdf",
"version": "v1.4.0", "version": "v1.5.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/beganovich/snappdf.git", "url": "https://github.com/beganovich/snappdf.git",
"reference": "2c878714145ef110cfec991c2e72cb6aeee7ed43" "reference": "63ad3f1a0eec7bffc3a3c85f286769fca9a33fd5"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/beganovich/snappdf/zipball/2c878714145ef110cfec991c2e72cb6aeee7ed43", "url": "https://api.github.com/repos/beganovich/snappdf/zipball/63ad3f1a0eec7bffc3a3c85f286769fca9a33fd5",
"reference": "2c878714145ef110cfec991c2e72cb6aeee7ed43", "reference": "63ad3f1a0eec7bffc3a3c85f286769fca9a33fd5",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -253,9 +253,9 @@
"description": "Convert webpages or HTML into the PDF file using Chromium or Google Chrome.", "description": "Convert webpages or HTML into the PDF file using Chromium or Google Chrome.",
"support": { "support": {
"issues": "https://github.com/beganovich/snappdf/issues", "issues": "https://github.com/beganovich/snappdf/issues",
"source": "https://github.com/beganovich/snappdf/tree/v1.4.0" "source": "https://github.com/beganovich/snappdf/tree/v1.5.0"
}, },
"time": "2021-01-03T20:26:24+00:00" "time": "2021-01-10T17:06:47+00:00"
}, },
{ {
"name": "brick/math", "name": "brick/math",