-
Notifications
You must be signed in to change notification settings - Fork 178
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
sfPatternRouting->getRoutes()
returns serialized routes
#169
Comments
sfPatternRouting->getRoutes()
returns serialized sfPatternRouting->getRoutes()
returns serialized routes
The link to your change doesn't seem to work. I believe the correct link is habitissimo@05c281b. My understanding is that the reason for the changes about serialization of routes was for performance. It would concern me that calling |
…times returning serialized routes FriendsOfSymfony1/symfony1#169 参照
Since
06b3ccf2
, cached routes are unserialized on demand, when callinggetRoute()
.This method will check with
is_string()
if the requested route has been already unserialized. If it has not, it will update itsroutes
attribute with the unserialized route. If we callgetRoute()
a few times, then theroutes
array may contain both serialized and unserialized routes.The plural
getRoutes()
just returns theroutes
array. If no call togetRoute()
has been made, then that array will contain a list of strings (serialized objects). IfgetRoute()
has been called before, thengetRoutes()
may return an array of mixed serialized and unserialized routes, which is quite unuseful.We've patched it, because there are times when we need to retrieve all routes, unserialized, and we were getting that array with unserialized and serialized routes mixed.
I'm willing to send you a PR to fix this behavior, including tests, but I've seen the following cases in
sfPatternRoutingTest
:According to the assertion description, the routes returned by
getRoutes()
(loaded from cache) should not be serialized; however, it checks one particular route returned bygetRoutes()
is astring
, which would mean it's not serialized. That's contradictory to me.Before preparing the PR, I need to know if it's ok with you if I change that test so it tests everything returned by
getRoutes()
andgetRoute()
is unserialized.I'd need to change that test, which could be seen as breaking change but, indeed, it would be the original Symfony 1 behavior.
The text was updated successfully, but these errors were encountered: