From 6ba804f717f0e3d2439b0fae6c5c2ad5dc47c5d8 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Tue, 7 Nov 2017 08:25:23 +1100 Subject: [PATCH] CRM-21395 make patch safe for multiple composer runs --- tools/scripts/composer/dompdf-cleanup.sh | 4 +++- .../composer/patches/dompdf_no_block_level_parent_fix.patch | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/scripts/composer/dompdf-cleanup.sh b/tools/scripts/composer/dompdf-cleanup.sh index 26345390de..bfe79d6ebd 100755 --- a/tools/scripts/composer/dompdf-cleanup.sh +++ b/tools/scripts/composer/dompdf-cleanup.sh @@ -130,4 +130,6 @@ make_font_readme > vendor/dompdf/dompdf/lib/fonts/README.DejaVuFonts.txt # Remove debug_print_backtrace(), which can leak system details. Put backtrace in log. simple_replace vendor/dompdf/dompdf/lib/html5lib/TreeBuilder.php 'debug_print_backtrace();' 'CRM_Core_Error::backtrace("backTrace", TRUE);' -patch vendor/dompdf/dompdf/src/Dompdf.php < tools/scripts/composer/patches/dompdf_no_block_level_parent_fix.patch +if ! grep -q 'CRM-21395' vendor/dompdf/dompdf/src/Dompdf.php; then + patch vendor/dompdf/dompdf/src/Dompdf.php < tools/scripts/composer/patches/dompdf_no_block_level_parent_fix.patch +fi diff --git a/tools/scripts/composer/patches/dompdf_no_block_level_parent_fix.patch b/tools/scripts/composer/patches/dompdf_no_block_level_parent_fix.patch index ead3df6bd7..29dd309d4a 100644 --- a/tools/scripts/composer/patches/dompdf_no_block_level_parent_fix.patch +++ b/tools/scripts/composer/patches/dompdf_no_block_level_parent_fix.patch @@ -18,7 +18,7 @@ index 40329063..bfb1c2b1 100644 $doc->loadHTML($str); $doc->encoding = $encoding; -+ // Remove #text children nodes in nodes that shouldn't have ++ // Remove #text children nodes in nodes that shouldn't have #CRM-21395 + $tag_names = array("html", "table", "tbody", "thead", "tfoot", "tr"); + foreach ($tag_names as $tag_name) { + $nodes = $doc->getElementsByTagName($tag_name); -- 2.25.1