Skip to content

Commit

Permalink
Update input.php
Browse files Browse the repository at this point in the history
  • Loading branch information
zero-24 committed Jun 14, 2015
1 parent e3a2a93 commit d0fb9f2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion libraries/joomla/filter/input.php
Expand Up @@ -156,8 +156,10 @@ public function __construct($tagsArray = array(), $attrArray = array(), $tagsMet
{
// Get the database driver
$db = JFactory::getDbo();

// This trick is required to let the driver determine the utf-8 multibyte support
$db->connect();

// And now we can decide if we should strip USCs
$this->stripUSC = $db->hasUTF8mb4Support() ? 0 : 1;
}
Expand Down Expand Up @@ -228,8 +230,8 @@ public function clean($source, $type = 'string')
// Strip Unicode Supplementary Characters when requested to do so
if ($this->stripUSC)
{
$source = preg_replace('/[\xF0-\xF7].../s', "\xE2\xAF\x91", $source);
// Alternatively: preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xE2\xAF\x91", $source) but it'd be slower.
$source = preg_replace('/[\xF0-\xF7].../s', "\xE2\xAF\x91", $source);
}

// Handle the type constraint
Expand Down

0 comments on commit d0fb9f2

Please sign in to comment.