Skip to content

Commit

Permalink
[11.x] PHP 8.4 Code compatibility (#53571)
Browse files Browse the repository at this point in the history
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 <crynobone@gmail.com>
  • Loading branch information
crynobone authored Nov 19, 2024
1 parent 47f4309 commit d7345b6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Illuminate/Support/Str.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public static function afterLast($subject, $search)
*/
public static function ascii($value, $language = 'en')
{
return ASCII::to_ascii((string) $value, $language);
return ASCII::to_ascii((string) $value, $language, replace_single_chars_only: false);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Validation/ValidationRuleParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ protected static function parseStringRule($rule)
*/
protected static function parseParameters($rule, $parameter)
{
return static::ruleIsRegex($rule) ? [$parameter] : str_getcsv($parameter);
return static::ruleIsRegex($rule) ? [$parameter] : str_getcsv($parameter, escape: '\\');
}

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/Validation/ValidationUniqueRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ public function testItCorrectlyFormatsAStringVersionOfTheRule()
$rule->ignore('Taylor, Otwell"\'..-"', 'id_column');
$rule->where('foo', 'bar');
$this->assertSame('unique:table,column,"Taylor, Otwell\"\\\'..-\"",id_column,foo,"bar"', (string) $rule);
$this->assertSame('Taylor, Otwell"\'..-"', stripslashes(str_getcsv('table,column,"Taylor, Otwell\"\\\'..-\"",id_column,foo,"bar"')[2]));
$this->assertSame('id_column', stripslashes(str_getcsv('table,column,"Taylor, Otwell\"\\\'..-\"",id_column,foo,"bar"')[3]));
$this->assertSame('Taylor, Otwell"\'..-"', stripslashes(str_getcsv('table,column,"Taylor, Otwell\"\\\'..-\"",id_column,foo,"bar"', escape: '\\')[2]));
$this->assertSame('id_column', stripslashes(str_getcsv('table,column,"Taylor, Otwell\"\\\'..-\"",id_column,foo,"bar"', escape: '\\')[3]));

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

0 comments on commit d7345b6

Please sign in to comment.