Treblle / treblle-laravel

The official Treblle SDK for Laravel. Seamlessly integrate Treblle to manage communication with your dashboard, send errors, and secure sensitive data.
https://www.treblle.com/
MIT License
129 stars 21 forks source link

Treblle\Utils\Masking\FieldMasker::handleString(): Argument #1 ($key) must be of type string #92

Closed michabbb closed 5 months ago

michabbb commented 5 months ago

Version

Description

Explain the context and how you encountered this bug.

seeing errors in laravel.log when doing requests to my API

Treblle\Utils\Masking\FieldMasker::handleString(): Argument #1 ($key) must be of type string, int given, called in 
 /app/vendor/treblle/utils/src/Masking/FieldMasker.php on line 22 {"userId":1,"exception":"[object] (TypeError(code: 0):  
Treblle\\Utils\\Masking\\FieldMasker::handleString(): Argument #1 ($key) must be of type string, int given, called in  
/app/vendor/treblle/utils/src/Masking/FieldMasker.php on line 22 at /app/vendor/treblle/utils/src/Masking/FieldMasker.php:33)

Steps to reproduce

the error happens when sending requests to my API. it´s a json body with a json response.

Expected behavior

no errors in laravel.log

Notes

just a hack, but I had to do this to temp fix it:

image

JustSteveKing commented 5 months ago

Thanks @michabbb

I will apply a patch shortly, unless you'd like to PR?

michabbb commented 5 months ago

I found a bug in your swagger generator that took a long time to talk to Vedran. Then I lost time because of this bug here. I have no deep insight into your code here and have no clue how this should be fixed in a way you like it. So please understand that I don´t want to waste another hour on something you can fix in 5 minutes. Thanks 😏

JustSteveKing commented 5 months ago

Not a problem @michabbb I am on it!

I need to apply this patch to the treblle/util php package first to then update the dependency here. You should see a new release available within the hour.

JustSteveKing commented 5 months ago

@michabbb new release is ready for you: https://github.com/Treblle/treblle-laravel/releases/tag/4.5.5

This has been expanded to allow int|string|float|bool to be safe. Hope this helps your use case