How to find the place of error in Laravel How to find such an error where happened the large code base?
{
"class": "Illuminate\Database\QueryException",
"message": "SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'phone' at row 1 (Connection: mysql, SQL: update `contacts` set `name` = test, `phone` = 999993992998997995996994989939933, `contacts`.`updated_at` = 2024-03-17 10:00:02 where `id` = 116088)",
"code": 22001,
"file": "/home/forge/test.com/vendor/laravel/framework/src/Illuminate/Database/Connection.php:801",
You should trace the error log. The log should have more information that tracing the execution of the code.
@MohamedTammam there is nothing clear in trace
"trace": [
"/home/forge/test.com/vendor/laravel/framework/src/Illuminate/Database/Connection.php:755",
"/home/forge/test.com/vendor/laravel/framework/src/Illuminate/Database/Connection.php:593",
"/home/forge/test.com/vendor/laravel/framework/src/Illuminate/Database/Connection.php:545",
@ahmeda No, that isn't the whole trace.
in some controller where you update a contact. Do you have a ContactsController?
@Snapey Yeah, but there is no query to update a contract there!
It's not possible to work out from the error log you posted - you'll have to look around at everywhere a Contact is updated. It looks like it's just a case of the phone number field not being properly validated.
Please sign in or create an account to participate in this conversation.