slope-it / breadcrumb-bundle

A bundle for generating dynamic breadcrumbs in Symfony applications
Other
10 stars 4 forks source link

Problem with breadcrumb builder keeping breadcrumbs in memory #26

Closed VerlooveMaxime closed 2 days ago

VerlooveMaxime commented 2 weeks ago

Hi,

If I'm not mistaken the builder saves breadcrumbs in memory on a controller request and these breadcrumbs are later read out by the twig function. The problem with storing the breadcrumbs in memory is that some configurations or webservers will persist this data between requests. I'm using Frankenphp with the php worker in production mode (the whole symfony app is booted once and kept in memory) and the builder contains breadcrumbs from other requests.

I've currently implemented my own loading method, but it might be worth looking into supporting long running apps. Maybe build the breadcrumbs when rendering the template, so you don't need to store them in memory.

asprega commented 2 days ago

Hi! Please try version 2.1.1 which I just released. It uses ResetInterface to remove state from the breadcrumb builder when container is reset and it should be the "correct" way to solve the issue you reported (even though the best solution would be to have stateless services, which would require quite a bit of refactoring and I don't have the resources to do it now).

If you can, let me know if it helped! Thanks.