Closed dakur closed 1 year ago
cc @enumag
Hmm... interesting... maybe this could help? https://github.com/nette/tracy/commit/a495ae9ea4dfbde7d1674a46d824cc160a963765
@enumag Yep, that works too.
Considering that toArray() format depends on implementation so it might not always be exactly what we expect I think clone is the better option in this case. It can't change the result and won't destroy the self-destructive implementations.
Version: 2.9.6
Bug Description
When I have
Ds\Stack
in my application which is inside of some service registered to DIC and I want to render all items in the stack into custom tracy panel, they are all gone.That's because
ContainerPanel
fromnette/di
dumps all services into text representation and part of dumping is a call toExposer
.Exposer
has specialexposeDsCollection()
method for instances ofDs\Collection
and runsforeach
on the collection. But it doesn't count with the fact that some ofDs\Collection
implementation have destructive behavior ā such asDs\Stack
(ref) orDs\Queue
(ref).Steps To Reproduce
Expected Behavior
To see:
as
Logger::log()
is called in both places. But onlyfrom panel
is rendered.Possible Solution
Call
$obj->toArray()
inexposeDsCollection()
method. But I'm not sure if it doesn't have any other consequences, I'm not so experienced in semantics of various data structures and their conversions.Other possibility can be to differentiate specific
Ds\Collection
implementations separately.