Skip to content

Commit e4ac43c

Browse files
authored
Merge pull request #43 from newtlabs/patch-1
Replace deprecated FILTER_SANITIZE_STRING with strip_tags() for PHP 8.1+ compatibility
2 parents 65cf5d3 + f84c6d7 commit e4ac43c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

wp-config.load.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,12 @@ function s24_load_environment_config() {
4343

4444
// Define ENV from hostname
4545
if (!defined('WP_ENV')) {
46-
if (isset($_SERVER['HTTP_X_FORWARDED_HOST']) && !empty($_SERVER['HTTP_X_FORWARDED_HOST'])) {
47-
$hostname = strtolower(filter_var($_SERVER['HTTP_X_FORWARDED_HOST'], FILTER_SANITIZE_STRING));
46+
if (!empty($_SERVER['HTTP_X_FORWARDED_HOST'])) {
47+
$hostname = strtolower(trim(strip_tags($_SERVER['HTTP_X_FORWARDED_HOST'])));
48+
} elseif (!empty($_SERVER['HTTP_HOST'])) {
49+
$hostname = strtolower(trim(strip_tags($_SERVER['HTTP_HOST'])));
4850
} else {
49-
$hostname = strtolower(filter_var($_SERVER['HTTP_HOST'], FILTER_SANITIZE_STRING));
51+
throw new Exception("Hostname is not available.");
5052
}
5153
}
5254

0 commit comments

Comments
 (0)