Placing uninflected check before irregular rules. Refs [8169] and #6351

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@8170 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
mark_story 2009-05-08 13:25:19 +00:00
parent 109bda97b8
commit 8b24d976f2

View file

@ -385,16 +385,16 @@ class Inflector extends Object {
$_this->singularRules['regexIrregular'] = $regexIrregular;
}
if (preg_match('/(.*)\\b(' . $regexIrregular . ')$/i', $word, $regs)) {
$_this->singularized[$word] = $regs[1] . substr($word, 0, 1) . substr($irregular[strtolower($regs[2])], 1);
return $_this->singularized[$word];
}
if (preg_match('/^(' . $regexUninflected . ')$/i', $word, $regs)) {
$_this->singularized[$word] = $word;
return $word;
}
if (preg_match('/(.*)\\b(' . $regexIrregular . ')$/i', $word, $regs)) {
$_this->singularized[$word] = $regs[1] . substr($word, 0, 1) . substr($irregular[strtolower($regs[2])], 1);
return $_this->singularized[$word];
}
foreach ($singularRules as $rule => $replacement) {
if (preg_match($rule, $word)) {
$_this->singularized[$word] = preg_replace($rule, $replacement, $word);