mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Modified Inflector::slug to not drop multibyte characters. Fixes #6104.
This commit is contained in:
parent
986af28de0
commit
659c1a65bc
2 changed files with 6 additions and 1 deletions
|
@ -447,10 +447,11 @@ class Inflector extends Object {
|
|||
'/Ü/' => 'Ue',
|
||||
'/Ö/' => 'Oe',
|
||||
'/ß/' => 'ss',
|
||||
'/[^\w\s]/' => ' ',
|
||||
'/[^\w\s\p{Ll}\p{Lm}\p{Lo}\p{Lt}\p{Lu}\p{Nd}]/mu' => ' ',
|
||||
'/\\s+/' => $replacement,
|
||||
sprintf('/^[%s]+|[%s]+$/', $quotedReplacement, $quotedReplacement) => '',
|
||||
);
|
||||
|
||||
$map = array_merge($default, $map);
|
||||
return preg_replace(array_keys($map), array_values($map), $string);
|
||||
}
|
||||
|
|
|
@ -200,6 +200,10 @@ class InflectorTest extends CakeTestCase {
|
|||
$result = Inflector::slug('#this melts your face1#2#3', '-');
|
||||
$expected = 'this-melts-your-face1-2-3';
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$result = Inflector::slug('controller/action/りんご/1');
|
||||
$expected = 'controller_action_りんご_1';
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
/**
|
||||
* testInflectorSlugWithMap method
|
||||
|
|
Loading…
Reference in a new issue