Development

#4460 (sfPatternRouting does not work with cachedata)

You must first sign up to be able to contribute.

Ticket #4460 (closed defect: fixed)

Opened 5 years ago

Last modified 5 years ago

sfPatternRouting does not work with cachedata

Reported by: ryanliu Assigned to: fabien
Priority: minor Milestone: 1.2.0
Component: routing Version: 1.2.0 DEV
Keywords: routing cacheData Cc:
Qualification: Unreviewed

Description

sfPatternRouting.class.php line 3119

public function generate($name, $params = array(), $absolute = false)

{

if (!is_null($this->cache)) {

$cacheKey = 'generate_'.$name.'_'.md5(serialize(array_merge($this->defaultParameters, $params))).'_'.md5(serialize($this->optionscontext?));

if (isset($this->cacheData[$cacheKey])) {

return $this->cacheData[$cacheKey];

}

}

........................

$url = $route->generate($params, $this->optionscontext?, $absolute); if (!is_null($this->cache)) {

$this->cacheChanged = true; $this->cacheData[$cacheKey] = $url;

}

return $this->fixGeneratedUrl($url, $absolute);

}


I make a directory for my backend application to /web/backend/, and I moved /web/backend.php to /web/backend/index.php.

http://localhost/backend/ it looks OK, but when I try to write some links to the template file, error was here:

link_to('TEXT', 'mymodule/someaction') returns "<a href=/mymodule/someaction.." what I want was "<a href=/backend/mymodule/someaction.."


Edit line 3126

return $this->cacheData[$cacheKey];

to return $this->fixGeneratedUrl($this->cacheData[$cacheKey], $absolute);

or Edit line 3145 to

$url = $this->fixGeneratedUrl($url, $absolute); if (!is_null($this->cache)) {

$this->cacheChanged = true; $this->cacheData[$cacheKey] = $url;

} return $url;

all was OK.

Change History

09/23/08 17:04:29 changed by fabien

  • status changed from new to closed.
  • resolution set to fixed.

(In [11749]) [1.2] fixed the routing when using a cache object (closes #4460)