mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
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
This commit is contained in:
parent
109bda97b8
commit
8b24d976f2
1 changed files with 5 additions and 5 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue