Permalink
Browse files

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
  • Loading branch information...
1 parent 109bda9 commit 8b24d976f2e4617a758bef5f665ffdd5ebd74ea7 @markstory markstory committed May 8, 2009
Showing with 5 additions and 5 deletions.
  1. +5 −5 cake/libs/inflector.php
@@ -385,16 +385,16 @@ function singularize($word) {
$_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);

0 comments on commit 8b24d97

Please sign in to comment.