From: Jani Taskinen Date: Fri, 17 Jul 2009 11:13:51 +0000 (+0000) Subject: - Fixed bug #47481 (natcasesort() does not sort extended ASCII characters correctly) X-Git-Tag: php-5.2.11RC1~161 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5278a956f05171f66f99c2a76ccb09f711c42791;p=php - Fixed bug #47481 (natcasesort() does not sort extended ASCII characters correctly) --- diff --git a/NEWS b/NEWS index bd273459f8..441736f749 100644 --- a/NEWS +++ b/NEWS @@ -35,6 +35,8 @@ PHP NEWS errors when errors are logged). (Jani) - Fixed bug #48116 (Fixed build with Openssl 1.0). (Pierre, Al dot Smith at aeschi dot ch dot eu dot org) +- Fixed bug #47481 (natcasesort() does not sort extended ASCII characters + correctly). (Herman Radtke) - Fixed bug #47351 (Memory leak in DateTime). (Derick, Tobias John) - Fixed bug #45905 (imagefilledrectangle() clipping error). (markril at hotmail dot com, Pierre) diff --git a/ext/standard/strnatcmp.c b/ext/standard/strnatcmp.c index 2459e46e66..366c12449f 100644 --- a/ext/standard/strnatcmp.c +++ b/ext/standard/strnatcmp.c @@ -101,7 +101,7 @@ compare_left(char const **a, char const *aend, char const **b, char const *bend) */ PHPAPI int strnatcmp_ex(char const *a, size_t a_len, char const *b, size_t b_len, int fold_case) { - char ca, cb; + unsigned char ca, cb; char const *ap, *bp; char const *aend = a + a_len, *bend = b + b_len; diff --git a/ext/standard/tests/strings/bug47481.phpt b/ext/standard/tests/strings/bug47481.phpt new file mode 100644 index 0000000000..4c59a7c377 --- /dev/null +++ b/ext/standard/tests/strings/bug47481.phpt @@ -0,0 +1,57 @@ +--TEST-- +Bug #47481 (natcasesort() does not sort extended ASCII characters correctly) +--FILE-- + +--EXPECTF-- +-- Before sorting: -- +array(6) { + [0]=> + %string|unicode%(6) "Süden" + [1]=> + %string|unicode%(7) "spielen" + [2]=> + %string|unicode%(5) "Sonne" + [3]=> + %string|unicode%(4) "Wind" + [4]=> + %string|unicode%(5) "Regen" + [5]=> + %string|unicode%(4) "Meer" +} + +-- After Sorting: -- +bool(true) +array(6) { + [5]=> + %string|unicode%(4) "Meer" + [4]=> + %string|unicode%(5) "Regen" + [2]=> + %string|unicode%(5) "Sonne" + [1]=> + %string|unicode%(7) "spielen" + [0]=> + %string|unicode%(6) "Süden" + [3]=> + %string|unicode%(4) "Wind" +} +Done