Skip to content

Commit

Permalink
Hack for PHP 8.4 compat
Browse files Browse the repository at this point in the history
This should be reverted/changed after voku/portable-utf8 is updated to support PHP 8.4 properly (and the anti-xss dependency is updated).
  • Loading branch information
Alanaktion committed Feb 19, 2025
1 parent 6942432 commit 1ef8d7f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/helper/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,15 @@ public function parseText($str, $options = [], $ttl = null)
}

// Simplistic XSS protection
// TODO: remove error_reporting hack after voku/portable-utf8 is updated
if (PHP_VERSION_ID >= 80400) {
error_reporting(E_ALL & ~(E_NOTICE | E_USER_NOTICE | E_DEPRECATED));
}
$antiXss = new \voku\helper\AntiXSS();
$str = $antiXss->xss_clean($str);
if (PHP_VERSION_ID >= 80400) {
error_reporting(E_ALL & ~(E_NOTICE | E_USER_NOTICE));
}

// Pass to any plugin hooks
$str = \Helper\Plugin::instance()->callHook("text.parse.after", $str);
Expand Down

0 comments on commit 1ef8d7f

Please sign in to comment.