-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Description
There is an error in PHP 7. The lib it's always returning 'Malformatted' for every character, instead of the alphabet itself.
There is a problem in TextLanguageDetect, in the way the unicode compares to the hex of the blocks. It war working in PHP 5 but not in PHP 7.
// your average binary search algorithm
while ($low <= $high) {
$mid = floor(($low + $high) / 2);
if ($unicode < $blocks[$mid][0]) {
// if it's lower than the lower bound
$high = $mid - 1;
} elseif ($unicode > $blocks[$mid][1]) {
// if it's higher than the upper bound
$low = $mid + 1;
} else {
// found it
return $blocks[$mid];
}
}
I'd changed wiht this one to fix it
// your average binary search algorithm
while ($low <= $high) {
$mid = floor(($low + $high) / 2);
if ($unicode < hexdec($blocks[$mid][0])) {
// if it's lower than the lower bound
$high = $mid - 1;
} elseif ($unicode > hexdec($blocks[$mid][1])) {
// if it's higher than the upper bound
$low = $mid + 1;
} else {
// found it
return $blocks[$mid];
}
}
How do i make this changes accesible to everybody?
Metadata
Metadata
Assignees
Labels
No labels