diff --git a/lib/Cake/Test/Case/Utility/InflectorTest.php b/lib/Cake/Test/Case/Utility/InflectorTest.php index caf085ad1..343215098 100644 --- a/lib/Cake/Test/Case/Utility/InflectorTest.php +++ b/lib/Cake/Test/Case/Utility/InflectorTest.php @@ -123,6 +123,7 @@ class InflectorTest extends CakeTestCase { $this->assertEquals(Inflector::singularize('fungi'), 'fungus'); $this->assertEquals(Inflector::singularize('nuclei'), 'nucleus'); $this->assertEquals(Inflector::singularize('octopuses'), 'octopus'); + $this->assertEquals(Inflector::singularize('octopuses'), 'octopus'); $this->assertEquals(Inflector::singularize('radii'), 'radius'); $this->assertEquals(Inflector::singularize('stimuli'), 'stimulus'); $this->assertEquals(Inflector::singularize('syllabi'), 'syllabus'); @@ -178,6 +179,7 @@ class InflectorTest extends CakeTestCase { $this->assertEquals(Inflector::singularize('metadata'), 'metadata'); $this->assertEquals(Inflector::singularize('files_metadata'), 'files_metadata'); $this->assertEquals(Inflector::singularize('sieves'), 'sieve'); + $this->assertEquals(Inflector::singularize('blue_octopuses'), 'blue_octopus'); $this->assertEquals(Inflector::singularize(''), ''); } @@ -250,6 +252,7 @@ class InflectorTest extends CakeTestCase { $this->assertEquals(Inflector::pluralize('files_metadata'), 'files_metadata'); $this->assertEquals(Inflector::pluralize('stadia'), 'stadia'); $this->assertEquals(Inflector::pluralize('sieve'), 'sieves'); + $this->assertEquals(Inflector::pluralize('blue_octopus'), 'blue_octopuses'); $this->assertEquals(Inflector::pluralize(''), ''); } diff --git a/lib/Cake/Utility/Inflector.php b/lib/Cake/Utility/Inflector.php index 33e4ecf1c..0d245c517 100644 --- a/lib/Cake/Utility/Inflector.php +++ b/lib/Cake/Utility/Inflector.php @@ -387,7 +387,7 @@ class Inflector { } if (preg_match('/(.*)\\b(' . self::$_plural['cacheIrregular'] . ')$/i', $word, $regs)) { - self::$_cache['pluralize'][$word] = $regs[1] . substr($word, 0, 1) . substr(self::$_plural['merged']['irregular'][strtolower($regs[2])], 1); + self::$_cache['pluralize'][$word] = $regs[1] . substr($regs[2], 0, 1) . substr(self::$_plural['merged']['irregular'][strtolower($regs[2])], 1); return self::$_cache['pluralize'][$word]; } @@ -436,7 +436,7 @@ class Inflector { } if (preg_match('/(.*)\\b(' . self::$_singular['cacheIrregular'] . ')$/i', $word, $regs)) { - self::$_cache['singularize'][$word] = $regs[1] . substr($word, 0, 1) . substr(self::$_singular['merged']['irregular'][strtolower($regs[2])], 1); + self::$_cache['singularize'][$word] = $regs[1] . substr($regs[2], 0, 1) . substr(self::$_singular['merged']['irregular'][strtolower($regs[2])], 1); return self::$_cache['singularize'][$word]; }