Skip to content
This repository
Browse code

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...
commit 8b24d976f2e4617a758bef5f665ffdd5ebd74ea7 1 parent 109bda9
Mark Story authored May 08, 2009

Showing 1 changed file with 5 additions and 5 deletions. Show diff stats Hide diff stats

  1. 10  cake/libs/inflector.php
10  cake/libs/inflector.php
@@ -385,16 +385,16 @@ function singularize($word) {
385 385
 			$_this->singularRules['regexIrregular'] = $regexIrregular;
386 386
 		}
387 387
 
388  
-		if (preg_match('/(.*)\\b(' . $regexIrregular . ')$/i', $word, $regs)) {
389  
-			$_this->singularized[$word] = $regs[1] . substr($word, 0, 1) . substr($irregular[strtolower($regs[2])], 1);
390  
-			return $_this->singularized[$word];
391  
-		}
392  
-
393 388
 		if (preg_match('/^(' . $regexUninflected . ')$/i', $word, $regs)) {
394 389
 			$_this->singularized[$word] = $word;
395 390
 			return $word;
396 391
 		}
397 392
 
  393
+		if (preg_match('/(.*)\\b(' . $regexIrregular . ')$/i', $word, $regs)) {
  394
+			$_this->singularized[$word] = $regs[1] . substr($word, 0, 1) . substr($irregular[strtolower($regs[2])], 1);
  395
+			return $_this->singularized[$word];
  396
+		}
  397
+
398 398
 		foreach ($singularRules as $rule => $replacement) {
399 399
 			if (preg_match($rule, $word)) {
400 400
 				$_this->singularized[$word] = preg_replace($rule, $replacement, $word);

0 notes on commit 8b24d97

Please sign in to comment.
Something went wrong with that request. Please try again.