-
Notifications
You must be signed in to change notification settings - Fork 585
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RedisWatcher does not serialize an object and throws a conversion error #1366
Comments
@CSalih is there any simplier example where we can use to create a test to cover the bugfix? |
Starting from predis 2.1.1 it is possible to apply an implementation of `Predis\Command\Argument\ArrayableArgument` fixes laravel/telescope#1366 Signed-off-by: Mior Muhammad Zaki <[email protected]>
Hi @crynobone, the simples way is probably to create a A simple test could be like: $properties = ["idx", "*", new PredisCommandArgumentFake()];
$commandExecuted = new CommandExecuted("command", $properties, ...);
// test should make sure `toArray` is called
// test formatted string should contain the same return value of the Fake class
// ...
// with this test(s) any predis command argument should be covered. For code quality i would suggest to test any kind of type $properties = ["str", 12, 12.5, true, [], new stdClass()];
$commandExecuted = new CommandExecuted("command", $properties, ...);
// properties may be an invalid redis client argument but it avoids the application to break here
// with this test we make sure implode does not fail anyway I hope I could be helpful to you. |
…7902) * [9.x] Normalise predis command argument where it maybe an object. Starting from predis 2.1.1 it is possible to apply an implementation of `Predis\Command\Argument\ArrayableArgument` fixes laravel/telescope#1366 Signed-off-by: Mior Muhammad Zaki <[email protected]> * Apply fixes from StyleCI * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * formatting --------- Signed-off-by: Mior Muhammad Zaki <[email protected]> Co-authored-by: StyleCI Bot <[email protected]> Co-authored-by: Taylor Otwell <[email protected]>
…7902) * [9.x] Normalise predis command argument where it maybe an object. Starting from predis 2.1.1 it is possible to apply an implementation of `Predis\Command\Argument\ArrayableArgument` fixes laravel/telescope#1366 Signed-off-by: Mior Muhammad Zaki <[email protected]> * Apply fixes from StyleCI * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * formatting --------- Signed-off-by: Mior Muhammad Zaki <[email protected]> Co-authored-by: StyleCI Bot <[email protected]> Co-authored-by: Taylor Otwell <[email protected]>
A PR to fix this issue has been merged on Laravel Framework 9 and will be available soon. |
Telescope Version
4.15.2
Laravel Version
9.x
PHP Version
8.2
Database Driver & Version
Description
Predis requires for some commands an object as argument (e.g for search) but
RedisWatcher::formatCommand
does not serialize objects, due to the missing serializing an object will be returned instead of a string and implode fails to concatenate it.Because the list of
$parameters
may contain an object a serialization is required to avoid an exception.I made for myself a dirty quick patch but it needs a better solution to make sure
$parameter
is always a string.Steps To Reproduce
TELESCOPE_REDIS_WATCHER=true
)REDIS_CLIENT=predis
)The command itself will be executed successfully but dispatch of
CommandExecuted
throws an exception with the message: "Object of class Predis\Command\Argument\Search\SearchArguments could not be converted to string".The text was updated successfully, but these errors were encountered: