Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 985cd57

Browse files
fixed uninitialized string offset for Porter::doubleConsonant($str)
1 parent 6d61487 commit 985cd57

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

‎src/Stemmers/PorterStemmer.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,12 @@ private static function doubleConsonant($str)
437437
{
438438
$c = self::$regex_consonant;
439439

440-
return preg_match("#$c[2]$#", $str, $matches) AND $matches[0][0] == $matches[0][1];
440+
$result = preg_match("#$c[2]$#", $str, $matches);
441+
442+
$sub_0 = count($matches) > 0 ? substr($matches[0], 0) : false;
443+
$sub_1 = count($matches) > 0 ? substr($matches[0], 1) : false;
444+
445+
return $result AND is_string($sub_0) AND is_string($sub_1) AND $sub_0 == $sub_1;
441446
}
442447

443448
/**

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /