From 547662f97c108c1f68dfa33905095d9888c909cd Mon Sep 17 00:00:00 2001 From: HugoPoi Date: Tue, 14 Nov 2023 18:07:16 +0100 Subject: [PATCH] fix: disable error for loadHTML because no html5 support by default in PHP --- docker-compose.yml | 5 ++++- php.Dockerfile | 4 ++++ www/index.php | 6 +++--- 3 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 php.Dockerfile diff --git a/docker-compose.yml b/docker-compose.yml index 31ab15f..8f6d016 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,6 +9,9 @@ services: - ./www:/var/www/html - ./docker-nginx-conf/default.conf:/etc/nginx/conf.d/default.conf php-fpm: - image: php:8-fpm + image: php:development + build: + context: . + dockerfile: php.Dockerfile volumes: - ./www:/var/www/html diff --git a/php.Dockerfile b/php.Dockerfile new file mode 100644 index 0000000..4952a2b --- /dev/null +++ b/php.Dockerfile @@ -0,0 +1,4 @@ +FROM php:8-fpm + +# Use the default production configuration +RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini" diff --git a/www/index.php b/www/index.php index 6e65d1e..6e1bbeb 100644 --- a/www/index.php +++ b/www/index.php @@ -401,7 +401,7 @@ function prepareContent( $file, $sourcePath ) $content = file_get_contents( $file ); foreach ( $LOADER['ARCHIVARIX_INCLUDE_CUSTOM'] as $includeCustom ) { - if ( $includeCustom['FILE'] && $includeCustom['KEYPHRASE'] ) { + if ( isset($includeCustom['FILE']) && $includeCustom['FILE'] && isset($includeCustom['KEYPHRASE']) && $includeCustom['KEYPHRASE'] ) { global $includeRule; $includeRule = $includeCustom; ob_start(); @@ -424,9 +424,9 @@ function prepareContent( $file, $sourcePath ) } $content = preg_replace( '~' . $includeCustom['KEYPHRASE'] . '~is', $includedContent, $content, $includeCustom['LIMIT'] ); - } else if ( $includeCustom['OPERATION'] && $includeCustom['XPATH'] ) { + } else if ( isset($includeCustom['OPERATION']) && $includeCustom['OPERATION'] && isset($includeCustom['XPATH']) && $includeCustom['XPATH'] ) { $doc = new DOMDocument(); - $doc->loadHTML($content); + $doc->loadHTML($content, LIBXML_NOERROR); $xpath = new DOMXpath($doc); $elementsToChange = $xpath->query($includeCustom['XPATH']);