Development

Changeset 7363

You must first sign up to be able to contribute.

Changeset 7363

Show
Ignore:
Timestamp:
02/06/08 11:22:42 (8 months ago)
Author:
pookey
Message:

If getCurrentInternalUri() was called once with true or false, and
then again with the opposite, the cached result would have been wrong
- this patch ensures the cached value is only ever returned if it's of

the same type.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.1/lib/routing/sfPatternRouting.class.php

    r6974 r7363  
    2525  protected 
    2626    $currentRouteName       = null, 
    27     $currentInternalUri     = null
     27    $currentInternalUri     = array()
    2828    $currentRouteParameters = null, 
    2929    $defaultSuffix          = '', 
     
    6666   * @return string The current internal URI 
    6767   */ 
     68 
    6869  public function getCurrentInternalUri($withRouteName = false) 
    6970  { 
     
    7374    } 
    7475 
    75     if (is_null($this->currentInternalUri)) 
     76    $typeId = ($withRouteName) ? 0 : 1; 
     77 
     78    if (!isset($this->currentInternalUri[$typeId])) 
    7679    { 
    7780      $parameters = $this->currentRouteParameters; 
     
    121124      sort($params); 
    122125 
    123       $this->currentInternalUri = $internalUri.($params ? '?'.implode('&', $params) : ''); 
    124     } 
    125  
    126     return $this->currentInternalUri
     126      $this->currentInternalUri[$typeId] = $internalUri.($params ? '?'.implode('&', $params) : ''); 
     127    } 
     128 
     129    return $this->currentInternalUri[$typeId]
    127130  } 
    128131 
     
    579582          // we store route name 
    580583          $this->currentRouteName = $routeName; 
    581           $this->currentInternalUri = null
     584          $this->currentInternalUri = array()
    582585 
    583586          if ($this->options['logging'])