Skip to content

Commit

Permalink
Always use ENT_SUBSTITUTE for HTML escape
Browse files Browse the repository at this point in the history
It's guaranteed to be present in 5.4+
  • Loading branch information
zerocrates committed Jan 27, 2020
1 parent 5d6bdc6 commit 72f1730
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions application/views/scripts/functions.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
<?php

// Use ENT_SUBSTITUTE when we're using a new-enough PHP version
if (defined('ENT_SUBSTITUTE')) {
function utf8_htmlspecialchars($value)
{
return htmlspecialchars($value, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
}
} else {
function utf8_htmlspecialchars($value)
{
return htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
}
function utf8_htmlspecialchars($value)
{
return htmlspecialchars($value, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
}

function show_untitled_items($title)
Expand Down

0 comments on commit 72f1730

Please sign in to comment.