Skip to content

Commit d4d1b7d

Browse files
committed
Revert "Speed up splitting strings into chars"
That function is only available in PHP 7.4 This reverts commit 56fb7a7.
1 parent 56fb7a7 commit d4d1b7d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Parser/Cursor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ public function advanceBy(int $characters, bool $advanceByColumns = false): void
247247
$asArray = [$nextFewChars];
248248
} elseif ($this->isMultibyte) {
249249
/** @var string[] $asArray */
250-
$asArray = \mb_str_split($nextFewChars);
250+
$asArray = \preg_split('//u', $nextFewChars, -1, \PREG_SPLIT_NO_EMPTY);
251251
} else {
252252
$asArray = \str_split($nextFewChars);
253253
}

src/Util/UrlEncoder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public static function unescapeAndEncode(string $uri): string
2929
$result = '';
3030

3131
/** @var string[] $chars */
32-
$chars = \mb_str_split($uri);
32+
$chars = \preg_split('//u', $uri, -1, \PREG_SPLIT_NO_EMPTY);
3333
$l = \count($chars);
3434
for ($i = 0; $i < $l; $i++) {
3535
$code = $chars[$i];

0 commit comments

Comments
 (0)