Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions application/helpers/html_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,12 @@ function pure_html(string $markup): string
{
$config = HTMLPurifier_Config::createDefault();

// By default, HTMLPurifier caches its serialized definitions inside its own vendor directory
// (vendor/ezyang/htmlpurifier/library/HTMLPurifier/DefinitionCache/Serializer), which is commonly
// deployed read-only or owned by a different user than the web server. Redirect it to storage/cache,
// the app's own writable data directory, to avoid write permission errors.
$config->set('Cache.SerializerPath', storage_path('cache'));

$purifier = new HTMLPurifier($config);

return $purifier->purify($markup);
Expand Down