dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Fix typo (sentances => sentences)"
[lhc/web/wiklou.git]
/
includes
/
Collation.php
diff --git
a/includes/Collation.php
b/includes/Collation.php
index
8554c2b
..
3cc7902
100644
(file)
--- a/
includes/Collation.php
+++ b/
includes/Collation.php
@@
-335,8
+335,12
@@
class IcuCollation extends Collation {
* sorts before all items.
*/
function findLowerBound( $valueCallback, $valueCount, $comparisonCallback, $target ) {
* sorts before all items.
*/
function findLowerBound( $valueCallback, $valueCount, $comparisonCallback, $target ) {
+ if ( $valueCount === 0 ) {
+ return false;
+ }
+
$min = 0;
$min = 0;
- $max = $valueCount
- 1
;
+ $max = $valueCount;
do {
$mid = $min + ( ( $max - $min ) >> 1 );
$item = call_user_func( $valueCallback, $mid );
do {
$mid = $min + ( ( $max - $min ) >> 1 );
$item = call_user_func( $valueCallback, $mid );
@@
-351,12
+355,15
@@
class IcuCollation extends Collation {
}
} while ( $min < $max - 1 );
}
} while ( $min < $max - 1 );
- if ( $min == 0 && $max == 0 && $comparison > 0 ) {
- // Before the first item
- return false;
- } else {
- return $min;
+ if ( $min == 0 ) {
+ $item = call_user_func( $valueCallback, $min );
+ $comparison = call_user_func( $comparisonCallback, $target, $item );
+ if ( $comparison < 0 ) {
+ // Before the first item
+ return false;
+ }
}
}
+ return $min;
}
static function isCjk( $codepoint ) {
}
static function isCjk( $codepoint ) {