-
Notifications
You must be signed in to change notification settings - Fork 77
Closed
Labels
Description
/**
*
* When cloning the Route, reset the `$attributes` to an empty array, and
* clear the `$failedRule`.
*
*/
public function __clone()
{
// $this is the cloned instance, not the original
$this->attributes = $this->defaults;
$this->failedRule = null;
}
comment says one thing / code does another
$map->allows(['GET', 'HEAD', 'POST'])->defaults(array(
'action' => 'foo',
));
$route = $map->route('test', '/test');
$route->defaults(array('action'=>'not foo'));
var_dump($route->attributes); // array('action'=>'foo')... I would expect empty array()
var_dump($route->defaults); // array('action'=>'not foo')
when dealing with routes I don't know if attribute came from url, or some inherited default
If I use Generator
to build this new route it's going to use the inherited default over the new default
$this->attributes = $this->defaults; // this does NOT reset `$attributes` to an empty array!!