summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDerek Jones <derek.jones@ellislab.com>2009-02-10 18:37:52 +0100
committerDerek Jones <derek.jones@ellislab.com>2009-02-10 18:37:52 +0100
commita6aabaff9a396436d36b57df84eec77ee72e70ed (patch)
tree5911a1c0ffee28a0b3436fe891ef66f2830d78ff
parent4787413c06ec11bff1ba4b1c7a4fe667038595d0 (diff)
Fixed a bug in plural() with words that end in y
http://codeigniter.com/bug_tracker/bug/6342/
-rw-r--r--system/helpers/inflector_helper.php4
-rw-r--r--user_guide/changelog.html1
2 files changed, 4 insertions, 1 deletions
diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php
index 9393f11e4..39db5d4af 100644
--- a/system/helpers/inflector_helper.php
+++ b/system/helpers/inflector_helper.php
@@ -87,7 +87,9 @@ if ( ! function_exists('plural'))
if ($end == 'y')
{
- $str = substr($str, 0, strlen($str)-1).'ies';
+ // Y preceded by vowel => regular plural
+ $vowels = array('a', 'e', 'i', 'o', 'u');
+ $str = in_array(substr($str, -2, 1), $vowels) ? $str.'s' : substr($str, 0, -1).'ies';
}
elseif ($end == 's')
{
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index 3d5e9b3ff..733bfc000 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -124,6 +124,7 @@ SVN Revision: </p>
<li>Fixed a bug when an opening quote is preceded by a paragraph tag and immediately followed by another tag.</li>
<li>Fixed a bug in the Text Helper affecting some locales where word_censor() would not work on words beginning or ending with an accented character.</li>
<li>Fixed a bug in the Text Helper character limiter where the provided limit intersects the last word of the string.</li>
+ <li>Fixed a bug (#6342) with plural() in the Inflection helper with words ending in "y".</li>
<li>Tweaked Typography::auto_typography() for some edge-cases.</li>
</ul>