Skip to content

Commit d7345b6

Browse files
authored
[11.x] PHP 8.4 Code compatibility (#53571)
Extract fixes to Laravel Framework for PHP 8.4 from #53468 PR. This would allows us to release fixes for our 1st party packages Signed-off-by: Mior Muhammad Zaki <[email protected]>
1 parent 47f4309 commit d7345b6

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/Illuminate/Support/Str.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public static function afterLast($subject, $search)
119119
*/
120120
public static function ascii($value, $language = 'en')
121121
{
122-
return ASCII::to_ascii((string) $value, $language);
122+
return ASCII::to_ascii((string) $value, $language, replace_single_chars_only: false);
123123
}
124124

125125
/**

src/Illuminate/Validation/ValidationRuleParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ protected static function parseStringRule($rule)
282282
*/
283283
protected static function parseParameters($rule, $parameter)
284284
{
285-
return static::ruleIsRegex($rule) ? [$parameter] : str_getcsv($parameter);
285+
return static::ruleIsRegex($rule) ? [$parameter] : str_getcsv($parameter, escape: '\\');
286286
}
287287

288288
/**

tests/Validation/ValidationUniqueRuleTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ public function testItCorrectlyFormatsAStringVersionOfTheRule()
5757
$rule->ignore('Taylor, Otwell"\'..-"', 'id_column');
5858
$rule->where('foo', 'bar');
5959
$this->assertSame('unique:table,column,"Taylor, Otwell\"\\\'..-\"",id_column,foo,"bar"', (string) $rule);
60-
$this->assertSame('Taylor, Otwell"\'..-"', stripslashes(str_getcsv('table,column,"Taylor, Otwell\"\\\'..-\"",id_column,foo,"bar"')[2]));
61-
$this->assertSame('id_column', stripslashes(str_getcsv('table,column,"Taylor, Otwell\"\\\'..-\"",id_column,foo,"bar"')[3]));
60+
$this->assertSame('Taylor, Otwell"\'..-"', stripslashes(str_getcsv('table,column,"Taylor, Otwell\"\\\'..-\"",id_column,foo,"bar"', escape: '\\')[2]));
61+
$this->assertSame('id_column', stripslashes(str_getcsv('table,column,"Taylor, Otwell\"\\\'..-\"",id_column,foo,"bar"', escape: '\\')[3]));
6262

6363
$rule = new Unique('table', 'column');
6464
$rule->ignore(null, 'id_column');

0 commit comments

Comments
 (0)