From 8b24d976f2e4617a758bef5f665ffdd5ebd74ea7 Mon Sep 17 00:00:00 2001 From: mark_story Date: Fri, 8 May 2009 13:25:19 +0000 Subject: [PATCH] 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 --- cake/libs/inflector.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cake/libs/inflector.php b/cake/libs/inflector.php index badf3d519..91c7e98ab 100644 --- a/cake/libs/inflector.php +++ b/cake/libs/inflector.php @@ -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);