@@ -158,7 +158,7 @@ protected function createIsolatedDiffTagPlaceholders(&$words)
158
158
foreach ($ words as $ index => $ word ) {
159
159
$ openIsolatedDiffTag = $ this ->isOpeningIsolatedDiffTag ($ word , $ currentIsolatedDiffTag );
160
160
if ($ openIsolatedDiffTag ) {
161
- if ($ this ->isSelfClosingTag ($ word ) || stripos ($ word , '<img ' ) !== false ) {
161
+ if ($ this ->isSelfClosingTag ($ word ) || mb_stripos ($ word , '<img ' ) !== false ) {
162
162
if ($ openIsolatedDiffTags === 0 ) {
163
163
$ isolatedDiffTagIndices [] = array (
164
164
'start ' => $ index ,
@@ -205,7 +205,7 @@ protected function isOpeningIsolatedDiffTag($item, $currentIsolatedDiffTag = nul
205
205
$ tagsToMatch = $ currentIsolatedDiffTag !== null
206
206
? array ($ currentIsolatedDiffTag => $ this ->config ->getIsolatedDiffTagPlaceholder ($ currentIsolatedDiffTag ))
207
207
: $ this ->config ->getIsolatedDiffTags ();
208
- $ pattern = '#<%s(\s+[^>]*)?>#iU ' ;
208
+ $ pattern = '#<%s(\s+[^>]*)?>#iUu ' ;
209
209
foreach ($ tagsToMatch as $ key => $ value ) {
210
210
if (preg_match (sprintf ($ pattern , $ key ), $ item )) {
211
211
return $ key ;
@@ -217,7 +217,7 @@ protected function isOpeningIsolatedDiffTag($item, $currentIsolatedDiffTag = nul
217
217
218
218
protected function isSelfClosingTag ($ text )
219
219
{
220
- return (bool ) preg_match ('/<[^>]+\/\s*>/ ' , $ text );
220
+ return (bool ) preg_match ('/<[^>]+\/\s*>/u ' , $ text );
221
221
}
222
222
223
223
/**
@@ -231,7 +231,7 @@ protected function isClosingIsolatedDiffTag($item, $currentIsolatedDiffTag = nul
231
231
$ tagsToMatch = $ currentIsolatedDiffTag !== null
232
232
? array ($ currentIsolatedDiffTag => $ this ->config ->getIsolatedDiffTagPlaceholder ($ currentIsolatedDiffTag ))
233
233
: $ this ->config ->getIsolatedDiffTags ();
234
- $ pattern = '#</%s(\s+[^>]*)?>#iU ' ;
234
+ $ pattern = '#</%s(\s+[^>]*)?>#iUu ' ;
235
235
foreach ($ tagsToMatch as $ key => $ value ) {
236
236
if (preg_match (sprintf ($ pattern , $ key ), $ item )) {
237
237
return $ key ;
@@ -354,7 +354,7 @@ protected function diffElements($oldText, $newText, $stripWrappingTags = true)
354
354
$ wrapEnd = '' ;
355
355
356
356
if ($ stripWrappingTags ) {
357
- $ pattern = '/(^<[^>]+>)|(<\/[^>]+>$)/i ' ;
357
+ $ pattern = '/(^<[^>]+>)|(<\/[^>]+>$)/iu ' ;
358
358
$ matches = array ();
359
359
360
360
if (preg_match_all ($ pattern , $ newText , $ matches )) {
@@ -441,7 +441,7 @@ protected function processEqualOperation($operation)
441
441
protected function getAttributeFromTag ($ text , $ attribute )
442
442
{
443
443
$ matches = array ();
444
- if (preg_match (sprintf ('/<[^>]*\b%s\s*=\s*([ \'"])(.*)\1[^>]*>/i ' , $ attribute ), $ text , $ matches )) {
444
+ if (preg_match (sprintf ('/<[^>]*\b%s\s*=\s*([ \'"])(.*)\1[^>]*>/iu ' , $ attribute ), $ text , $ matches )) {
445
445
return htmlspecialchars_decode ($ matches [2 ]);
446
446
}
447
447
@@ -567,15 +567,15 @@ protected function insertTag($tag, $cssClass, &$words)
567
567
}
568
568
}
569
569
}
570
- if (count ($ words ) == 0 && strlen ($ specialCaseTagInjection ) == 0 ) {
570
+ if (count ($ words ) == 0 && mb_strlen ($ specialCaseTagInjection ) == 0 ) {
571
571
break ;
572
572
}
573
573
if ($ specialCaseTagInjectionIsBefore ) {
574
574
$ this ->content .= $ specialCaseTagInjection .implode ('' , $ this ->extractConsecutiveWords ($ words , 'tag ' ));
575
575
} else {
576
576
$ workTag = $ this ->extractConsecutiveWords ($ words , 'tag ' );
577
577
if (isset ($ workTag [ 0 ]) && $ this ->isOpeningTag ($ workTag [ 0 ]) && !$ this ->isClosingTag ($ workTag [ 0 ])) {
578
- if (strpos ($ workTag [ 0 ], 'class= ' )) {
578
+ if (mb_strpos ($ workTag [ 0 ], 'class= ' )) {
579
579
$ workTag [ 0 ] = str_replace ('class=" ' , 'class="diffmod ' , $ workTag [ 0 ]);
580
580
$ workTag [ 0 ] = str_replace ("class=' " , 'class="diffmod ' , $ workTag [ 0 ]);
581
581
} else {
@@ -584,7 +584,7 @@ protected function insertTag($tag, $cssClass, &$words)
584
584
}
585
585
586
586
$ appendContent = implode ('' , $ workTag ).$ specialCaseTagInjection ;
587
- if (isset ($ workTag [0 ]) && false !== stripos ($ workTag [0 ], '<img ' )) {
587
+ if (isset ($ workTag [0 ]) && false !== mb_stripos ($ workTag [0 ], '<img ' )) {
588
588
$ appendContent = $ this ->wrapText ($ appendContent , $ tag , $ cssClass );
589
589
}
590
590
$ this ->content .= $ appendContent ;
@@ -673,7 +673,7 @@ protected function isTag($item)
673
673
*/
674
674
protected function isOpeningTag ($ item )
675
675
{
676
- return preg_match ('#<[^>]+> \\s*#iU ' , $ item );
676
+ return preg_match ('#<[^>]+> \\s*#iUu ' , $ item );
677
677
}
678
678
679
679
/**
@@ -683,7 +683,7 @@ protected function isOpeningTag($item)
683
683
*/
684
684
protected function isClosingTag ($ item )
685
685
{
686
- return preg_match ('#</[^>]+> \\s*#iU ' , $ item );
686
+ return preg_match ('#</[^>]+> \\s*#iUu ' , $ item );
687
687
}
688
688
689
689
/**
@@ -769,10 +769,10 @@ protected function findMatchingBlocks($startInOld, $endInOld, $startInNew, $endI
769
769
*/
770
770
protected function stripTagAttributes ($ word )
771
771
{
772
- $ space = strpos ($ word , ' ' , 1 );
772
+ $ space = mb_strpos ($ word , ' ' , 1 );
773
773
774
774
if ($ space ) {
775
- return '< ' . substr ($ word , 1 , $ space ) . '> ' ;
775
+ return '< ' . mb_substr ($ word , 1 , $ space ) . '> ' ;
776
776
}
777
777
778
778
return trim ($ word , '<> ' );
@@ -850,7 +850,7 @@ protected function findMatch($startInOld, $endInOld, $startInNew, $endInNew)
850
850
protected function isOnlyWhitespace ($ str )
851
851
{
852
852
// Slightly faster then using preg_match
853
- return $ str !== '' && (strlen (trim ($ str )) === 0 );
853
+ return $ str !== '' && (mb_strlen (trim ($ str )) === 0 );
854
854
}
855
855
856
856
/**
0 commit comments