Use named bindings in a database query, for example:
DB::select('select * from users where id = :id', bindings: ['id' => 1])
In my case, I have a stored procedure in another Oracle OCI connection that is called in the same manner, using named bindings.
When there is a query error, the package saves the bindings, but within resources/components/query-preview.blade.php, there is a section of code that retrieves the key and adds 1:
This modification ensures that if the key is an integer, it will be incremented by 1. If it is a string, it will be displayed as-is, preventing the "Unsupported operand types: string + int" error.
Feel free to adapt this to better fit the style and requirements of your bug report and pull request.
Description
Steps to reproduce the bug:
Use named bindings in a database query, for example:
DB::select('select * from users where id = :id', bindings: ['id' => 1])
In my case, I have a stored procedure in another Oracle OCI connection that is called in the same manner, using named bindings.
When there is a query error, the package saves the bindings, but within resources/components/query-preview.blade.php, there is a section of code that retrieves the key and adds 1:
Since the key is a string due to the named bindings, this results in an "Unsupported operand types: string + int" error.
Expected behavior:
The component should handle named bindings correctly without throwing an error.
Current behavior:
The application throws an "Unsupported operand types: string + int" error when named bindings are used and the key is a string.
Package version:
"bezhansalleh/filament-exceptions": "^2.1"
Environment:
PHP: 8.2.1 Laravel: 10.48.14 Operating System: WSL with Ubuntu 20.04
Pull Request Suggestion
To fix this issue, I suggest adding a validation to check if the key is an integer before performing the addition. Here is the proposed change:
File: resources/components/query-preview.blade.php
This modification ensures that if the key is an integer, it will be incremented by 1. If it is a string, it will be displayed as-is, preventing the "Unsupported operand types: string + int" error.
Feel free to adapt this to better fit the style and requirements of your bug report and pull request.