Skip to content

Commit

Permalink
Fix resource not escaped correctly (laravel#53100)
Browse files Browse the repository at this point in the history
When bindings contain a resource (e.g. file resource), then it is not escaped correctly. Additionally, the gettype() call is to ensure that a closed resource is also escaped correctly. The latter is an edge-case scenario, which can be encountered in situations when a file handler has already been closed, and one attempts to log the executed query, e.g. via using barryvdh/laravel-debugbar.
  • Loading branch information
aedart authored and timacdonald committed Oct 15, 2024
1 parent d4e5be7 commit 3a1ee16
Showing 1 changed file with 1 addition and 1 deletion.
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 @@ -1526,7 +1526,7 @@ protected function removeLeadingBoolean($value)
*/
public function substituteBindingsIntoRawSql($sql, $bindings)
{
$bindings = array_map(fn ($value) => $this->escape($value), $bindings);
$bindings = array_map(fn ($value) => $this->escape($value, is_resource($value) || gettype($value) === 'resource (closed)'), $bindings);

$query = '';

Expand Down

0 comments on commit 3a1ee16

Please sign in to comment.