Skip to content
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

(fixed #4438) Fix sfPatternRouting->getRoutes() sometimes returning serialized routes #605

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/vendor/symfony/lib/routing/sfPatternRouting.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,14 @@ public function getCurrentRouteName()
*/
public function getRoutes()
{
foreach ($this->routes as $name => $route) {
if (is_string($route)) {
$route = unserialize($route);
$route->setDefaultParameters($this->defaultParameters);
$this->routes[$name] = $route;
}
}

return $this->routes;
}

Expand Down
4 changes: 2 additions & 2 deletions lib/vendor/symfony/test/unit/routing/sfPatternRoutingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -639,8 +639,8 @@ function configureRouting($event)
// see fixtures/config_routing.yml.php
$r = new sfPatternRoutingTest(new sfEventDispatcher(), new sfNoCache(), array('load_configuration' => true));
$t->ok($r->hasRouteName('test1'), '->loadConfiguration() Config file is loaded');
$routes = $r->getRoutes();
$t->ok(is_string($routes['test1']), '->loadConfiguration() Route objects are not serialized in cache');
$route = $r->getRoute('test1');
$t->ok(is_object($route), '->loadConfiguration() Route objects are unserialized on demand');
$routes = $r->getRoutes();
$t->ok(is_object($routes['test1']), '->loadConfiguration() Route objects are not serialized in cache');
$t->is_deeply($r->parse('/'), array('module' => 'default', 'action' => 'index'), '->parse() Default parameters are applied to serialized routes');