sampart / BreadcrumbsBundle

A small breadcrumbs bundle for Symfony

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support PHP-PM by resetting state

Sander-Toonen opened this issue · comments

When using this bundle with php-pm the breadcrumbs show alls paths that all previous users have visited. E.g:

Home > Register > Home > Profile > Change Password > Home > Contact > Home > Contact, ... etc

This happens because WhiteOctober\BreadcrumbsBundle\Model\Breadcrumbs is a service that keeps state. Symfony 3.3 added a dependency injection tag that allows Symfony to call a reset()-method on the service after a request has been processed. This way, services can clean up any state so that a next request can be processed.

Symfony itself is already resetting certain services: symfony/symfony#23984

Since the Breadcrumbs class already has a clear() method that does exactly what is needed, adding the DI-tag should be all that is needed. I'll add a PR soon.

Would like to see this merged :)

Thanks all for your patience & contributions. This is now in release https://github.com/whiteoctober/BreadcrumbsBundle/releases/tag/1.4.2.