Development

Changeset 27755 for branches/1.3

You must first sign up to be able to contribute.

Changeset 27755 for branches/1.3

Show
Ignore:
Timestamp:
02/08/10 21:51:02 (1 month ago)
Author:
Kris.Wallsmith
Message:

[1.3, 1.4] fixed double escaping of partial vars (closes #7825, refs #1638)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.3/lib/helper/PartialHelper.php

    r23810 r27755  
    139139  $class = sfConfig::get('mod_'.strtolower($moduleName).'_partial_view_class', 'sf').'PartialView'; 
    140140  $view = new $class($context, $moduleName, $actionName, ''); 
    141   $view->setPartialVars($vars); 
     141  $view->setPartialVars(true === sfConfig::get('sf_escaping_strategy') ? sfOutputEscaper::unescape($vars) : $vars); 
    142142 
    143143  if ($retval = $view->getCache()) 
     
    214214  $class = sfConfig::get('mod_'.strtolower($moduleName).'_partial_view_class', 'sf').'PartialView'; 
    215215  $view = new $class($context, $moduleName, $actionName, ''); 
    216   $view->setPartialVars($vars); 
     216  $view->setPartialVars(true === sfConfig::get('sf_escaping_strategy') ? sfOutputEscaper::unescape($vars) : $vars); 
    217217 
    218218  return $view->render(); 
  • branches/1.3/test/functional/escapingTest.php

    r23902 r27755  
    1717$b = new sfTestBrowser(); 
    1818 
    19 $b-> 
    20   get('/escaping/on')-> 
    21   with('request')->begin()-> 
    22     isParameter('module', 'escaping')-> 
    23     isParameter('action', 'on')-> 
    24   end()-> 
    25   with('response')->begin()-> 
    26     isStatusCode(200)-> 
    27     matches('#<h1>Lorem &lt;strong&gt;ipsum&lt;/strong&gt; dolor sit amet.</h1>#')-> 
    28     matches('#<h2>Lorem &lt;strong&gt;ipsum&lt;/strong&gt; dolor sit amet.</h2>#')-> 
    29   end() 
     19$b->get('/escaping/on') 
     20 
     21  ->with('request')->begin() 
     22    ->isParameter('module', 'escaping') 
     23    ->isParameter('action', 'on') 
     24  ->end() 
     25 
     26  ->with('response')->begin() 
     27    ->isStatusCode(200) 
     28    ->matches('#<h1>Lorem &lt;strong&gt;ipsum&lt;/strong&gt; dolor sit amet.</h1>#') 
     29    ->matches('#<h2>Lorem &lt;strong&gt;ipsum&lt;/strong&gt; dolor sit amet.</h2>#') 
     30    ->matches('#<h3>Lorem &lt;strong&gt;ipsum&lt;/strong&gt; dolor sit amet.</h3>#') 
     31    ->matches('#<h4>Lorem <strong>ipsum</strong> dolor sit amet.</h4>#') 
     32    ->matches('#<h5>Lorem &lt;strong&gt;ipsum&lt;/strong&gt; dolor sit amet.</h5>#') 
     33    ->matches('#<h6>Lorem <strong>ipsum</strong> dolor sit amet.</h6>#') 
     34    ->checkElement('span.no', 2) 
     35  ->end() 
    3036; 
    3137 
    32 $b-> 
    33   get('/escaping/off')-> 
    34   with('request')->begin()-> 
    35     isParameter('module', 'escaping')-> 
    36     isParameter('action', 'off')-> 
    37   end()-> 
    38   with('response')->begin()-> 
    39     isStatusCode(200)-> 
    40     matches('#<h1>Lorem <strong>ipsum</strong> dolor sit amet.</h1>#')-> 
    41     matches('#<h2>Lorem <strong>ipsum</strong> dolor sit amet.</h2>#')-> 
    42   end() 
     38$b->get('/escaping/off') 
     39 
     40  ->with('request')->begin() 
     41    ->isParameter('module', 'escaping') 
     42    ->isParameter('action', 'off') 
     43  ->end() 
     44 
     45  ->with('response')->begin() 
     46    ->isStatusCode(200) 
     47    ->matches('#<h1>Lorem <strong>ipsum</strong> dolor sit amet.</h1>#') 
     48    ->matches('#<h2>Lorem <strong>ipsum</strong> dolor sit amet.</h2>#') 
     49  ->end() 
    4350; 
  • branches/1.3/test/functional/fixtures/apps/frontend/modules/escaping/actions/actions.class.php

    r20546 r27755  
    2020  public function executeOn() 
    2121  { 
    22     sfConfig::set('sf_escaping_strategy', 'on'); 
     22    sfConfig::set('sf_escaping_strategy', true); 
    2323  } 
    2424 
    2525  public function executeOff() 
    2626  { 
    27     sfConfig::set('sf_escaping_strategy', 'off'); 
     27    sfConfig::set('sf_escaping_strategy', false); 
    2828  } 
    2929} 
  • branches/1.3/test/functional/fixtures/apps/frontend/modules/escaping/templates/indexSuccess.php

    r8260 r27755  
    11<h1><?php echo $var ?></h1> 
    22<h2><?php echo $sf_data->get('var') ?></h2> 
     3 
     4<?php include_partial('escaping/partial1', array('var' => $var, 'arr' => array())) ?> 

The Sensio Labs Network

Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting.
Sensio Labs also supports several large Open-Source projects.