Skip to content

Commit

Permalink
fix escaping quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Aug 5, 2020
1 parent 1b70bef commit 687df01
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Illuminate/Database/Query/Grammars/Grammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -1202,7 +1202,7 @@ protected function wrapJsonFieldAndPath($column)
*/
protected function wrapJsonPath($value, $delimiter = '->')
{
$value = preg_replace("/([\\\\]+)?\\'/", "\\'", $value);
$value = preg_replace("/([\\\\]+)?\\'/", "''", $value);

return '\'$."'.str_replace($delimiter, '"."', $value).'"\'';
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Database/DatabaseQueryBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2623,7 +2623,7 @@ public function testMySqlWrappingJsonWithBooleanAndIntegerThatLooksLikeOne()
public function testJsonPathEscaping()
{
$expectedWithJsonEscaped = <<<SQL
select json_unquote(json_extract(`json`, '$."\'))#"'))
select json_unquote(json_extract(`json`, '$."''))#"'))
SQL;

$builder = $this->getMySqlBuilder();
Expand Down

0 comments on commit 687df01

Please sign in to comment.