From 87fc0a7d0488dc0bf5cefa5108144bbea7db789a Mon Sep 17 00:00:00 2001
From: Alex Pott <alex.a.pott@googlemail.com>
Date: Tue, 21 Dec 2021 09:27:26 +0000
Subject: [PATCH] Issue #3186524 by longwave, alexpott, xjm, Spokje: Fix
 htaccess files for PHP 8

---
 .htaccess                                               | 5 +++++
 composer/Plugin/VendorHardening/FileSecurity.php        | 3 +++
 core/assets/scaffold/files/htaccess                     | 5 +++++
 core/lib/Drupal/Component/FileSecurity/FileSecurity.php | 3 +++
 4 files changed, 16 insertions(+)

diff --git a/.htaccess b/.htaccess
index b1ee36bf4c39..4d19147cc464 100644
--- a/.htaccess
+++ b/.htaccess
@@ -32,6 +32,11 @@ AddEncoding gzip svgz
   php_value assert.active                   0
 </IfModule>
 
+# PHP 8, Apache 1 and 2.
+<IfModule mod_php.c>
+  php_value assert.active                   0
+</IfModule>
+
 # Requires mod_expires to be enabled.
 <IfModule mod_expires.c>
   # Enable expirations.
diff --git a/composer/Plugin/VendorHardening/FileSecurity.php b/composer/Plugin/VendorHardening/FileSecurity.php
index 6e89744beb9f..3d168cca925c 100644
--- a/composer/Plugin/VendorHardening/FileSecurity.php
+++ b/composer/Plugin/VendorHardening/FileSecurity.php
@@ -77,6 +77,9 @@ protected static function htaccessPreventExecution() {
 <IfModule mod_php7.c>
   php_flag engine off
 </IfModule>
+<IfModule mod_php.c>
+  php_flag engine off
+</IfModule>
 EOF;
   }
 
diff --git a/core/assets/scaffold/files/htaccess b/core/assets/scaffold/files/htaccess
index b1ee36bf4c39..4d19147cc464 100644
--- a/core/assets/scaffold/files/htaccess
+++ b/core/assets/scaffold/files/htaccess
@@ -32,6 +32,11 @@ AddEncoding gzip svgz
   php_value assert.active                   0
 </IfModule>
 
+# PHP 8, Apache 1 and 2.
+<IfModule mod_php.c>
+  php_value assert.active                   0
+</IfModule>
+
 # Requires mod_expires to be enabled.
 <IfModule mod_expires.c>
   # Enable expirations.
diff --git a/core/lib/Drupal/Component/FileSecurity/FileSecurity.php b/core/lib/Drupal/Component/FileSecurity/FileSecurity.php
index 1b90afd8ddae..aaebcca68024 100644
--- a/core/lib/Drupal/Component/FileSecurity/FileSecurity.php
+++ b/core/lib/Drupal/Component/FileSecurity/FileSecurity.php
@@ -75,6 +75,9 @@ protected static function htaccessPreventExecution() {
 <IfModule mod_php7.c>
   php_flag engine off
 </IfModule>
+<IfModule mod_php.c>
+  php_flag engine off
+</IfModule>
 EOF;
   }
 
-- 
GitLab