Patch proposal

10 views
Skip to first unread message

Eugenijus Januškevičius

unread,
May 6, 2023, 6:05:53 AM5/6/23
to ResourceSpace
Dear Developers,

I had some trouble when generating and altering contents some time ago, and the culprit was in the class.Diff.php file. The " /\R/u" is essential for preg_split().

The bug is still in the 10.1 release. The diff from the 9.4 (the patched one) to 10.1 is here:


diff -r -u rs/94/lib/Diff/class.Diff.php rs/10.1/lib/Diff/class.Diff.php
--- rs/94/lib/Diff/class.Diff.php      2020-11-25 10:56:13.000000000 +0000
+++  rs/10.1/lib/Diff/class.Diff.php     2023-05-06 09:37:06.126533438 +0000
@@ -44,8 +44,8 @@
       $end1 = strlen($string1) - 1;
       $end2 = strlen($string2) - 1;
     }else{
-      $sequence1 = preg_split('/\R/u', $string1);
-      $sequence2 = preg_split('/\R/u', $string2);
+      $sequence1 = preg_split('/\r/', $string1);
+      $sequence2 = preg_split('/\r/', $string2);
       $end1 = count($sequence1) - 1;
       $end2 = count($sequence2) - 1;
     }

Eugenijus Januškevičius

unread,
May 6, 2023, 7:15:10 AM5/6/23
to ResourceSpace
This will close the following issue:

OHNE /u :
Array ( [0] => � [1] => , � [2] => , � [3] => , � [4] => , � [5] => , � [6] => , � [7] => , � [8] => , � [9] => , � [10] => , � [11] => , � [12] => , � [13] => , � [14] => , � [15] => , � [16] => )
MIT /u :
Array ( [0] => Å, ą, Ņ, ƅ, Dž, ȅ, Ʌ, ʅ, ΅, υ, Ѕ, х, Ӆ, ԅ, Յ, օ )


$test_string ='Å'; //           0xC3 0x85 LATIN CAPITAL LETTER A WITH RING ABOVE
$test_string .=', ą'; //        0xC4 0x85 LATIN SMALL LETTER A WITH OGONEK
$test_string .=', Ņ'; //        0xC5 0x85 LATIN CAPITAL LETTER N WITH CEDILLA
$test_string .= ', ƅ'; //       0xC6 0x85 LATIN SMALL LETTER TONE SIX
$test_string .=', Dž'; //        0xC7 0x85 LATIN CAPITAL LETTER D WITH SMALL LETTER Z WITH CARON
$test_string .=', ȅ'; //        0xC8 0x85 LATIN SMALL LETTER E WITH DOUBLE GRAVE
$test_string .=', Ʌ'; //        0xC9 0x85 LATIN CAPITAL LETTER TURNED V
$test_string .=', ʅ'; //        0xCA 0x85 LATIN SMALL LETTER SQUAT REVERSED ESH
$test_string .=', ΅'; //        0xCF 0x85 GREEK DIALYTIKA TONOS
$test_string .=', υ'; //        0xCE 0x85 GREEK SMALL LETTER UPSILON
$test_string .=', Ѕ'; //        0xD0 0x85 CYRILLIC CAPITAL LETTER DZE
$test_string .=', х'; //        0xd1 0x85       CYRILLIC SMALL LETTER HA
$test_string .=', Ӆ'; //        0xd3 0x85       CYRILLIC CAPITAL LETTER EL WITH TAIL
$test_string .=', ԅ'; //        0xd4 0x85       CYRILLIC SMALL LETTER KOMI ZJE
$test_string .=', Յ'; //        0xd5 0x85       ARMENIAN CAPITAL LETTER YI
$test_string .=', օ'; //        0xd6 0x85       ARMENIAN SMALL LETTER OH

echo"OHNE /u :<br/>";
print_r(preg_split('/\R/', $test_string));

echo"<br/>MIT /u :<br/>";
print_r(preg_split('/\R/u', $test_string));

Reply all
Reply to author
Forward
0 new messages