Skip to content

Commit bf28535

Browse files
authored
Cast JSON strings containing single quotes (#37619)
1 parent eab26e1 commit bf28535

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Illuminate/Foundation/Testing/Concerns/InteractsWithDatabase.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,9 @@ public function castAsJson($value)
134134
$value = json_encode($value);
135135
}
136136

137-
return DB::raw("CAST('$value' AS JSON)");
137+
$value = DB::connection()->getPdo()->quote($value);
138+
139+
return DB::raw("CAST($value AS JSON)");
138140
}
139141

140142
/**

0 commit comments

Comments
 (0)