Development

Changeset 7722

You must first sign up to be able to contribute.

Changeset 7722

Show
Ignore:
Timestamp:
03/03/08 11:39:00 (8 months ago)
Author:
fabien
Message:

removed sfContext dependency for sfResponse

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.1/lib/response/sfResponse.class.php

    r7714 r7722  
    5454      $this->options['logging'] = false; 
    5555    } 
     56  } 
     57 
     58  /** 
     59   * Sets the event dispatcher. 
     60   * 
     61   * @param sfEventDispatcher A sfEventDispatcher instance 
     62   */ 
     63  public function setEventDispatcher(sfEventDispatcher $dispatcher) 
     64  { 
     65    $this->dispatcher = $dispatcher; 
    5666  } 
    5767 
     
    138148  /** 
    139149   * Unserializes a sfResponse instance. 
     150   * 
     151   * You need to inject a dispatcher after unserializing a sfWebResponse instance. 
    140152   */ 
    141153  public function unserialize($serialized) 
    142154  { 
    143     $data = unserialize($serialized); 
    144  
    145     $this->initialize(sfContext::hasInstance() ? sfContext::getInstance()->getEventDispatcher() : new sfEventDispatcher()); 
    146  
    147     $this->content = $data; 
     155    $this->content = unserialize($serialized); 
    148156  } 
    149157} 
  • branches/1.1/lib/response/sfWebResponse.class.php

    r7714 r7722  
    2525    $statusCode  = 200, 
    2626    $statusText  = 'OK', 
    27     $statusTexts = array(), 
    2827    $headerOnly  = false, 
    2928    $headers     = array(), 
     
    3534    $slots       = array(); 
    3635 
     36  static protected $statusTexts = array( 
     37    '100' => 'Continue', 
     38    '101' => 'Switching Protocols', 
     39    '200' => 'OK', 
     40    '201' => 'Created', 
     41    '202' => 'Accepted', 
     42    '203' => 'Non-Authoritative Information', 
     43    '204' => 'No Content', 
     44    '205' => 'Reset Content', 
     45    '206' => 'Partial Content', 
     46    '300' => 'Multiple Choices', 
     47    '301' => 'Moved Permanently', 
     48    '302' => 'Found', 
     49    '303' => 'See Other', 
     50    '304' => 'Not Modified', 
     51    '305' => 'Use Proxy', 
     52    '306' => '(Unused)', 
     53    '307' => 'Temporary Redirect', 
     54    '400' => 'Bad Request', 
     55    '401' => 'Unauthorized', 
     56    '402' => 'Payment Required', 
     57    '403' => 'Forbidden', 
     58    '404' => 'Not Found', 
     59    '405' => 'Method Not Allowed', 
     60    '406' => 'Not Acceptable', 
     61    '407' => 'Proxy Authentication Required', 
     62    '408' => 'Request Timeout', 
     63    '409' => 'Conflict', 
     64    '410' => 'Gone', 
     65    '411' => 'Length Required', 
     66    '412' => 'Precondition Failed', 
     67    '413' => 'Request Entity Too Large', 
     68    '414' => 'Request-URI Too Long', 
     69    '415' => 'Unsupported Media Type', 
     70    '416' => 'Requested Range Not Satisfiable', 
     71    '417' => 'Expectation Failed', 
     72    '500' => 'Internal Server Error', 
     73    '501' => 'Not Implemented', 
     74    '502' => 'Bad Gateway', 
     75    '503' => 'Service Unavailable', 
     76    '504' => 'Gateway Timeout', 
     77    '505' => 'HTTP Version Not Supported', 
     78  ); 
     79 
    3780  /** 
    3881   * Initializes this sfWebResponse. 
     
    5699      $this->options['charset'] = 'utf-8'; 
    57100    } 
    58  
    59     $this->statusTexts = array( 
    60       '100' => 'Continue', 
    61       '101' => 'Switching Protocols', 
    62       '200' => 'OK', 
    63       '201' => 'Created', 
    64       '202' => 'Accepted', 
    65       '203' => 'Non-Authoritative Information', 
    66       '204' => 'No Content', 
    67       '205' => 'Reset Content', 
    68       '206' => 'Partial Content', 
    69       '300' => 'Multiple Choices', 
    70       '301' => 'Moved Permanently', 
    71       '302' => 'Found', 
    72       '303' => 'See Other', 
    73       '304' => 'Not Modified', 
    74       '305' => 'Use Proxy', 
    75       '306' => '(Unused)', 
    76       '307' => 'Temporary Redirect', 
    77       '400' => 'Bad Request', 
    78       '401' => 'Unauthorized', 
    79       '402' => 'Payment Required', 
    80       '403' => 'Forbidden', 
    81       '404' => 'Not Found', 
    82       '405' => 'Method Not Allowed', 
    83       '406' => 'Not Acceptable', 
    84       '407' => 'Proxy Authentication Required', 
    85       '408' => 'Request Timeout', 
    86       '409' => 'Conflict', 
    87       '410' => 'Gone', 
    88       '411' => 'Length Required', 
    89       '412' => 'Precondition Failed', 
    90       '413' => 'Request Entity Too Large', 
    91       '414' => 'Request-URI Too Long', 
    92       '415' => 'Unsupported Media Type', 
    93       '416' => 'Requested Range Not Satisfiable', 
    94       '417' => 'Expectation Failed', 
    95       '500' => 'Internal Server Error', 
    96       '501' => 'Not Implemented', 
    97       '502' => 'Bad Gateway', 
    98       '503' => 'Service Unavailable', 
    99       '504' => 'Gateway Timeout', 
    100       '505' => 'HTTP Version Not Supported', 
    101     ); 
    102101  } 
    103102 
     
    174173  { 
    175174    $this->statusCode = $code; 
    176     $this->statusText = null !== $name ? $name : $this->statusTexts[$code]; 
     175    $this->statusText = null !== $name ? $name : self::$statusTexts[$code]; 
    177176  } 
    178177 
     
    694693 
    695694  /** 
    696    * Serializes the current instance. 
    697    * 
    698    * @return array Objects instance 
     695   * @see sfResponse 
    699696   */ 
    700697  public function serialize() 
     
    704701 
    705702  /** 
    706    * Unserializes a sfWebResponse instance. 
     703   * @see sfResponse 
    707704   */ 
    708705  public function unserialize($serialized) 
    709706  { 
    710     $data = unserialize($serialized); 
    711  
    712     $this->initialize(sfContext::hasInstance() ? sfContext::getInstance()->getEventDispatcher() : new sfEventDispatcher()); 
    713  
    714     list($this->content, $this->statusCode, $this->statusText, $this->options, $this->cookies, $this->headerOnly, $this->headers, $this->metas, $this->httpMetas, $this->stylesheets, $this->javascripts, $this->slots) = $data; 
     707    list($this->content, $this->statusCode, $this->statusText, $this->options, $this->cookies, $this->headerOnly, $this->headers, $this->metas, $this->httpMetas, $this->stylesheets, $this->javascripts, $this->slots) = unserialize($serialized); 
    715708  } 
    716709 
  • branches/1.1/lib/view/sfViewCacheManager.class.php

    r7717 r7722  
    637637    $cache = unserialize($cache); 
    638638    $content = $cache['content']; 
     639    $cache['response']->setEventDispatcher($this->dispatcher); 
    639640    $this->context->getResponse()->mergeProperties($cache['response']); 
    640641 
     
    712713 
    713714    $cachedResponse = unserialize($retval); 
     715    $cachedResponse->setEventDispatcher($this->dispatcher); 
    714716 
    715717    if (sfView::RENDER_VAR == $this->controller->getRenderMode())