fix: disable error for loadHTML because no html5 support by default in PHP

This commit is contained in:
Hugo Poissonnet 2023-11-14 18:07:16 +01:00
parent 84baa1d098
commit 547662f97c
No known key found for this signature in database
GPG Key ID: E581734975D3836F
3 changed files with 11 additions and 4 deletions

View File

@ -9,6 +9,9 @@ services:
- ./www:/var/www/html - ./www:/var/www/html
- ./docker-nginx-conf/default.conf:/etc/nginx/conf.d/default.conf - ./docker-nginx-conf/default.conf:/etc/nginx/conf.d/default.conf
php-fpm: php-fpm:
image: php:8-fpm image: php:development
build:
context: .
dockerfile: php.Dockerfile
volumes: volumes:
- ./www:/var/www/html - ./www:/var/www/html

4
php.Dockerfile Normal file
View File

@ -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"

View File

@ -401,7 +401,7 @@ function prepareContent( $file, $sourcePath )
$content = file_get_contents( $file ); $content = file_get_contents( $file );
foreach ( $LOADER['ARCHIVARIX_INCLUDE_CUSTOM'] as $includeCustom ) { 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; global $includeRule;
$includeRule = $includeCustom; $includeRule = $includeCustom;
ob_start(); ob_start();
@ -424,9 +424,9 @@ function prepareContent( $file, $sourcePath )
} }
$content = preg_replace( '~' . $includeCustom['KEYPHRASE'] . '~is', $includedContent, $content, $includeCustom['LIMIT'] ); $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 = new DOMDocument();
$doc->loadHTML($content); $doc->loadHTML($content, LIBXML_NOERROR);
$xpath = new DOMXpath($doc); $xpath = new DOMXpath($doc);
$elementsToChange = $xpath->query($includeCustom['XPATH']); $elementsToChange = $xpath->query($includeCustom['XPATH']);