Skip to content

Commit

Permalink
Killed 2 out of 3 mbstring uses.
Browse files Browse the repository at this point in the history
  • Loading branch information
Phil Sturgeon committed Dec 26, 2014
1 parent 3f7b787 commit 82421eb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Util/Html5Entities.php
Original file line number Diff line number Diff line change
Expand Up @@ -2278,9 +2278,9 @@ public static function fromDecimal($number)
{
$entity = '&#' . $number . ';';

$converted = mb_decode_numericentity($entity, array(0x0, 0x2FFFF, 0, 0xFFFF), 'UTF-8');
$converted = html_entity_decode($entity, ENT_COMPAT, 'UTF-8');

if ($converted == $entity) {
if ($converted === $entity) {
return self::fromHex('fffd');
}

Expand Down
3 changes: 2 additions & 1 deletion src/Util/TextHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ public static function detabLine($string)

foreach ($parts as $part) {
// Calculate number of spaces; insert them followed by the non-tab contents
$amount = 4 - mb_strlen($line, 'UTF-8') % 4;
$lineLength = preg_match_all('(.)su', $line);
$amount = 4 - $lineLength % 4;
$line .= str_repeat(' ', $amount) . $part;
}

Expand Down

0 comments on commit 82421eb

Please sign in to comment.