Skip to content

Commit

Permalink
Undo previous mbstring function replacements
Browse files Browse the repository at this point in the history
This reverts commits:

 - 6b28381
 - c7331db
 - 82421eb
  • Loading branch information
colinodell committed Jan 2, 2015
1 parent 89de853 commit 8c9d004
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 1,223 deletions.
6 changes: 2 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@
"colinodell/commonmark-php": "*"
},
"require": {
"php": ">=5.3.3"
},
"suggest": {
"ext-mbstring": "Enables faster performance when normalizing link references"
"php": ">=5.3.3",
"ext-mbstring": "*"
},
"require-dev": {
"erusev/parsedown": "~1.0",
Expand Down
8 changes: 0 additions & 8 deletions src/Reference/Reference.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

namespace League\CommonMark\Reference;

use League\CommonMark\Util\UnicodeCaseFolder;

/**
* Link reference
*/
Expand Down Expand Up @@ -89,12 +87,6 @@ public static function normalizeReference($string)
// leading/trailing whitespace
$string = preg_replace('/\s+/', '', trim($string));

// Convert to upper-case using Unicode case folding
// Use an alternate method if mb_strtoupper isn't available
if (!function_exists('mb_strtoupper')) {
return UnicodeCaseFolder::toUpperCase($string);
}

return mb_strtoupper($string, 'UTF-8');
}
}
2 changes: 1 addition & 1 deletion src/Util/Html5Entities.php
Original file line number Diff line number Diff line change
Expand Up @@ -2283,7 +2283,7 @@ public static function fromDecimal($number)

$entity = '&#' . $number . ';';

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

if ($converted === $entity) {
return self::fromHex('fffd');
Expand Down
3 changes: 1 addition & 2 deletions src/Util/TextHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ public static function detabLine($string)

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

Expand Down
Loading

0 comments on commit 8c9d004

Please sign in to comment.