diff --git a/composer.json b/composer.json index 12b4ea24c826..8878ff331799 100644 --- a/composer.json +++ b/composer.json @@ -57,7 +57,8 @@ "pear/Net_socket": "1.0.*", "civicrm/civicrm-setup": "~0.2.0", "guzzlehttp/guzzle": "^6.3", - "psr/simple-cache": "~1.0.1" + "psr/simple-cache": "~1.0.1", + "cweagans/composer-patches": "~1.0" }, "repositories": [ { @@ -80,5 +81,12 @@ "bash tools/scripts/composer/net-smtp-fix.sh", "bash tools/scripts/composer/phpword-jquery.sh" ] + }, + "extra": { + "patches": { + "phpoffice/phpword": { + "Fix handling of libxml_disable_entity_loader": "tools/scripts/composer/patches/phpword-libxml-fix-global-handling.patch" + } + } } } diff --git a/composer.lock b/composer.lock index 39ccfd74860a..4e254465e875 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "e151fc70ebe624a096262d68dfb0c2e2", + "content-hash": "b8d4e9d60251f27c6aa61611265fd4aa", "packages": [ { "name": "civicrm/civicrm-cxn-rpc", @@ -80,6 +80,50 @@ "description": "CiviCRM installation library", "time": "2018-01-23T06:26:55+00:00" }, + { + "name": "cweagans/composer-patches", + "version": "1.6.5", + "source": { + "type": "git", + "url": "https://github.com/cweagans/composer-patches.git", + "reference": "2ec4f00ff5fb64de584c8c4aea53bf9053ecb0b3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/cweagans/composer-patches/zipball/2ec4f00ff5fb64de584c8c4aea53bf9053ecb0b3", + "reference": "2ec4f00ff5fb64de584c8c4aea53bf9053ecb0b3", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0", + "php": ">=5.3.0" + }, + "require-dev": { + "composer/composer": "~1.0", + "phpunit/phpunit": "~4.6" + }, + "type": "composer-plugin", + "extra": { + "class": "cweagans\\Composer\\Patches" + }, + "autoload": { + "psr-4": { + "cweagans\\Composer\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Cameron Eagans", + "email": "me@cweagans.net" + } + ], + "description": "Provides a way to patch Composer packages.", + "time": "2018-05-11T18:00:16+00:00" + }, { "name": "dompdf/dompdf", "version": "v0.8.0", @@ -110,9 +154,6 @@ "extra": { "branch-alias": { "dev-develop": "0.7-dev" - }, - "patches_applied": { - "Fix Fatal error: Uncaught Dompdf Exception: No block-level parent found.": "tools/scripts/composer/patches/dompdf_no_block_level_parent_fix.patch" } }, "autoload": { @@ -529,14 +570,6 @@ "pear/auth_sasl": "Install optionally via your project's composer.json" }, "type": "library", - "extra": { - "patches_applied": { - "CRM-8744 Display CiviCRM Specific error message": "tools/scripts/composer/patches/net-smtp-patch.patch", - "Fix PHP7 Compliance": "tools/scripts/composer/patches/net-smtp-php7-patch.patch", - "Fix Pass by reference issues": "tools/scripts/composer/patches/net-smtp-ref-patch.patch", - "Fix TLS support issue in PHP5.6": "tools/scripts/composer/patches/net-smtp-tls-patch.patch" - } - }, "autoload": { "psr-0": { "Net": "./" @@ -896,6 +929,9 @@ "extra": { "branch-alias": { "dev-develop": "0.16-dev" + }, + "patches_applied": { + "Fix handling of libxml_disable_entity_loader": "tools/scripts/composer/patches/phpword-libxml-fix-global-handling.patch" } }, "autoload": { diff --git a/tools/scripts/composer/patches/phpword-libxml-fix-global-handling.patch b/tools/scripts/composer/patches/phpword-libxml-fix-global-handling.patch new file mode 100644 index 000000000000..da6f8f0c4cc3 --- /dev/null +++ b/tools/scripts/composer/patches/phpword-libxml-fix-global-handling.patch @@ -0,0 +1,51 @@ +From 27ee4bef48def2e3b966b6d5ff8cc8c56b1fac2c Mon Sep 17 00:00:00 2001 +From: Seamus Lee +Date: Sun, 24 Feb 2019 09:06:51 +1100 +Subject: [PATCH] Ensure that entity_loader disable variable is re-set back to + the original setting + +--- + src/PhpWord/Shared/Html.php | 2 ++ + src/PhpWord/TemplateProcessor.php | 2 ++ + 3 files changed, 6 insertions(+), 1 deletion(-) + +diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php +index 89881822ca..f25cf5f4a6 100644 +--- a/src/PhpWord/Shared/Html.php ++++ b/src/PhpWord/Shared/Html.php +@@ -72,6 +72,7 @@ public static function addHtml($element, $html, $fullHTML = false, $preserveWhit + } + + // Load DOM ++ $orignalLibEntityLoader = libxml_disable_entity_loader(); + libxml_disable_entity_loader(true); + $dom = new \DOMDocument(); + $dom->preserveWhiteSpace = $preserveWhiteSpace; +@@ -80,6 +81,7 @@ public static function addHtml($element, $html, $fullHTML = false, $preserveWhit + $node = $dom->getElementsByTagName('body'); + + self::parseNode($node->item(0), $element); ++ libxml_disable_entity_loader($orignalLibEntityLoader); + } + + /** +diff --git a/src/PhpWord/TemplateProcessor.php b/src/PhpWord/TemplateProcessor.php +index 0f685bc45b..fa605b19c5 100644 +--- a/src/PhpWord/TemplateProcessor.php ++++ b/src/PhpWord/TemplateProcessor.php +@@ -170,6 +170,7 @@ protected function readPartWithRels($fileName) + */ + protected function transformSingleXml($xml, $xsltProcessor) + { ++ $orignalLibEntityLoader = libxml_disable_entity_loader(); + libxml_disable_entity_loader(true); + $domDocument = new \DOMDocument(); + if (false === $domDocument->loadXML($xml)) { +@@ -180,6 +181,7 @@ protected function transformSingleXml($xml, $xsltProcessor) + if (false === $transformedXml) { + throw new Exception('Could not transform the given XML document.'); + } ++ libxml_disable_entity_loader($orignalLibEntityLoader); + + return $transformedXml; + }