Skip to content

Commit

Permalink
Cast JSON strings containing single quotes (#37619)
Browse files Browse the repository at this point in the history
  • Loading branch information
dees040 authored Jun 8, 2021
1 parent eab26e1 commit bf28535
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ public function castAsJson($value)
$value = json_encode($value);
}

return DB::raw("CAST('$value' AS JSON)");
$value = DB::connection()->getPdo()->quote($value);

return DB::raw("CAST($value AS JSON)");
}

/**
Expand Down

0 comments on commit bf28535

Please sign in to comment.