Author: Kris.Wallsmith
Date: 2010-02-08 21:51:02 +0100 (Mon, 08 Feb 2010)
New Revision: 27755
Added:
branches/1.3/test/functional/fixtures/apps/frontend/modules/escaping/templates/_partial1.php
branches/1.3/test/functional/fixtures/apps/frontend/modules/escaping/templates/_partial2.php
branches/1.4/test/functional/fixtures/apps/frontend/modules/escaping/templates/_partial1.php
branches/1.4/test/functional/fixtures/apps/frontend/modules/escaping/templates/_partial2.php
Modified:
branches/1.3/lib/helper/PartialHelper.php
branches/1.3/test/functional/escapingTest.php
branches/1.3/test/functional/fixtures/apps/frontend/modules/escaping/actions/actions.class.php
branches/1.3/test/functional/fixtures/apps/frontend/modules/escaping/templates/indexSuccess.php
branches/1.4/lib/helper/PartialHelper.php
branches/1.4/test/functional/escapingTest.php
branches/1.4/test/functional/fixtures/apps/frontend/modules/escaping/actions/actions.class.php
branches/1.4/test/functional/fixtures/apps/frontend/modules/escaping/templates/indexSuccess.php
Log:
[1.3, 1.4] fixed double escaping of partial vars (closes #7825, refs #1638)
Modified: branches/1.3/lib/helper/PartialHelper.php
===================================================================
--- branches/1.3/lib/helper/PartialHelper.php 2010-02-08 19:54:57 UTC (rev
27754)
+++ branches/1.3/lib/helper/PartialHelper.php 2010-02-08 20:51:02 UTC (rev
27755)
@@ -138,7 +138,7 @@
$class = sfConfig::get('mod_'.strtolower($moduleName).'_partial_view_class',
'sf').'PartialView';
$view = new $class($context, $moduleName, $actionName, '');
- $view->setPartialVars($vars);
+ $view->setPartialVars(true === sfConfig::get('sf_escaping_strategy') ?
sfOutputEscaper::unescape($vars) : $vars);
if ($retval = $view->getCache())
{
@@ -213,7 +213,7 @@
$class = sfConfig::get('mod_'.strtolower($moduleName).'_partial_view_class',
'sf').'PartialView';
$view = new $class($context, $moduleName, $actionName, '');
- $view->setPartialVars($vars);
+ $view->setPartialVars(true === sfConfig::get('sf_escaping_strategy') ?
sfOutputEscaper::unescape($vars) : $vars);
return $view->render();
}
Modified: branches/1.3/test/functional/escapingTest.php
===================================================================
--- branches/1.3/test/functional/escapingTest.php 2010-02-08 19:54:57 UTC
(rev 27754)
+++ branches/1.3/test/functional/escapingTest.php 2010-02-08 20:51:02 UTC
(rev 27755)
@@ -16,28 +16,35 @@
$b = new sfTestBrowser();
-$b->
- get('/escaping/on')->
- with('request')->begin()->
- isParameter('module', 'escaping')->
- isParameter('action', 'on')->
- end()->
- with('response')->begin()->
- isStatusCode(200)->
- matches('#<h1>Lorem <strong>ipsum</strong> dolor sit
amet.</h1>#')->
- matches('#<h2>Lorem <strong>ipsum</strong> dolor sit
amet.</h2>#')->
- end()
+$b->get('/escaping/on')
+
+ ->with('request')->begin()
+ ->isParameter('module', 'escaping')
+ ->isParameter('action', 'on')
+ ->end()
+
+ ->with('response')->begin()
+ ->isStatusCode(200)
+ ->matches('#<h1>Lorem <strong>ipsum</strong> dolor sit
amet.</h1>#')
+ ->matches('#<h2>Lorem <strong>ipsum</strong> dolor sit
amet.</h2>#')
+ ->matches('#<h3>Lorem <strong>ipsum</strong> dolor sit
amet.</h3>#')
+ ->matches('#<h4>Lorem <strong>ipsum</strong> dolor sit amet.</h4>#')
+ ->matches('#<h5>Lorem <strong>ipsum</strong> dolor sit
amet.</h5>#')
+ ->matches('#<h6>Lorem <strong>ipsum</strong> dolor sit amet.</h6>#')
+ ->checkElement('span.no', 2)
+ ->end()
;
-$b->
- get('/escaping/off')->
- with('request')->begin()->
- isParameter('module', 'escaping')->
- isParameter('action', 'off')->
- end()->
- with('response')->begin()->
- isStatusCode(200)->
- matches('#<h1>Lorem <strong>ipsum</strong> dolor sit amet.</h1>#')->
- matches('#<h2>Lorem <strong>ipsum</strong> dolor sit amet.</h2>#')->
- end()
+$b->get('/escaping/off')
+
+ ->with('request')->begin()
+ ->isParameter('module', 'escaping')
+ ->isParameter('action', 'off')
+ ->end()
+
+ ->with('response')->begin()
+ ->isStatusCode(200)
+ ->matches('#<h1>Lorem <strong>ipsum</strong> dolor sit amet.</h1>#')
+ ->matches('#<h2>Lorem <strong>ipsum</strong> dolor sit amet.</h2>#')
+ ->end()
;
Modified:
branches/1.3/test/functional/fixtures/apps/frontend/modules/escaping/actions/actions.class.php
===================================================================
---
branches/1.3/test/functional/fixtures/apps/frontend/modules/escaping/actions/actions.class.php
2010-02-08 19:54:57 UTC (rev 27754)
+++
branches/1.3/test/functional/fixtures/apps/frontend/modules/escaping/actions/actions.class.php
2010-02-08 20:51:02 UTC (rev 27755)
@@ -19,11 +19,11 @@
public function executeOn()
{
- sfConfig::set('sf_escaping_strategy', 'on');
+ sfConfig::set('sf_escaping_strategy', true);
}
public function executeOff()
{
- sfConfig::set('sf_escaping_strategy', 'off');
+ sfConfig::set('sf_escaping_strategy', false);
}
}
Added:
branches/1.3/test/functional/fixtures/apps/frontend/modules/escaping/templates/_partial1.php
===================================================================
---
branches/1.3/test/functional/fixtures/apps/frontend/modules/escaping/templates/_partial1.php
(rev 0)
+++
branches/1.3/test/functional/fixtures/apps/frontend/modules/escaping/templates/_partial1.php
2010-02-08 20:51:02 UTC (rev 27755)
@@ -0,0 +1,6 @@
+<h3><?php echo $var ?></h3>
+<h4><?php echo $sf_data->getRaw('var') ?></h4>
+
+<span class="<?php echo $sf_data->getRaw('arr') ? 'yes' : 'no' ?>"></span>
+
+<?php include_partial('escaping/partial2', array('var' => $var, 'arr' =>
$arr)) ?>
Property changes on:
branches/1.3/test/functional/fixtures/apps/frontend/modules/escaping/templates/_partial1.php
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Added:
branches/1.3/test/functional/fixtures/apps/frontend/modules/escaping/templates/_partial2.php
===================================================================
---
branches/1.3/test/functional/fixtures/apps/frontend/modules/escaping/templates/_partial2.php
(rev 0)
+++
branches/1.3/test/functional/fixtures/apps/frontend/modules/escaping/templates/_partial2.php
2010-02-08 20:51:02 UTC (rev 27755)
@@ -0,0 +1,4 @@
+<h5><?php echo $var ?></h5>
+<h6><?php echo $sf_data->getRaw('var') ?></h6>
+
+<span class="<?php echo $sf_data->getRaw('arr') ? 'yes' : 'no' ?>"></span>
Property changes on:
branches/1.3/test/functional/fixtures/apps/frontend/modules/escaping/templates/_partial2.php
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Modified:
branches/1.3/test/functional/fixtures/apps/frontend/modules/escaping/templates/indexSuccess.php
===================================================================
---
branches/1.3/test/functional/fixtures/apps/frontend/modules/escaping/templates/indexSuccess.php
2010-02-08 19:54:57 UTC (rev 27754)
+++
branches/1.3/test/functional/fixtures/apps/frontend/modules/escaping/templates/indexSuccess.php
2010-02-08 20:51:02 UTC (rev 27755)
@@ -1,2 +1,4 @@
<h1><?php echo $var ?></h1>
<h2><?php echo $sf_data->get('var') ?></h2>
+
+<?php include_partial('escaping/partial1', array('var' => $var, 'arr' =>
array())) ?>
Modified: branches/1.4/lib/helper/PartialHelper.php
===================================================================
--- branches/1.4/lib/helper/PartialHelper.php 2010-02-08 19:54:57 UTC (rev
27754)
+++ branches/1.4/lib/helper/PartialHelper.php 2010-02-08 20:51:02 UTC (rev
27755)
@@ -138,7 +138,7 @@
$class = sfConfig::get('mod_'.strtolower($moduleName).'_partial_view_class',
'sf').'PartialView';
$view = new $class($context, $moduleName, $actionName, '');
- $view->setPartialVars($vars);
+ $view->setPartialVars(true === sfConfig::get('sf_escaping_strategy') ?
sfOutputEscaper::unescape($vars) : $vars);
if ($retval = $view->getCache())
{
@@ -213,7 +213,7 @@
$class = sfConfig::get('mod_'.strtolower($moduleName).'_partial_view_class',
'sf').'PartialView';
$view = new $class($context, $moduleName, $actionName, '');
- $view->setPartialVars($vars);
+ $view->setPartialVars(true === sfConfig::get('sf_escaping_strategy') ?
sfOutputEscaper::unescape($vars) : $vars);
return $view->render();
}
Modified: branches/1.4/test/functional/escapingTest.php
===================================================================
--- branches/1.4/test/functional/escapingTest.php 2010-02-08 19:54:57 UTC
(rev 27754)
+++ branches/1.4/test/functional/escapingTest.php 2010-02-08 20:51:02 UTC
(rev 27755)
@@ -16,28 +16,35 @@
$b = new sfTestBrowser();
-$b->
- get('/escaping/on')->
- with('request')->begin()->
- isParameter('module', 'escaping')->
- isParameter('action', 'on')->
- end()->
- with('response')->begin()->
- isStatusCode(200)->
- matches('#<h1>Lorem <strong>ipsum</strong> dolor sit
amet.</h1>#')->
- matches('#<h2>Lorem <strong>ipsum</strong> dolor sit
amet.</h2>#')->
- end()
+$b->get('/escaping/on')
+
+ ->with('request')->begin()
+ ->isParameter('module', 'escaping')
+ ->isParameter('action', 'on')
+ ->end()
+
+ ->with('response')->begin()
+ ->isStatusCode(200)
+ ->matches('#<h1>Lorem <strong>ipsum</strong> dolor sit
amet.</h1>#')
+ ->matches('#<h2>Lorem <strong>ipsum</strong> dolor sit
amet.</h2>#')
+ ->matches('#<h3>Lorem <strong>ipsum</strong> dolor sit
amet.</h3>#')
+ ->matches('#<h4>Lorem <strong>ipsum</strong> dolor sit amet.</h4>#')
+ ->matches('#<h5>Lorem <strong>ipsum</strong> dolor sit
amet.</h5>#')
+ ->matches('#<h6>Lorem <strong>ipsum</strong> dolor sit amet.</h6>#')
+ ->checkElement('span.no', 2)
+ ->end()
;
-$b->
- get('/escaping/off')->
- with('request')->begin()->
- isParameter('module', 'escaping')->
- isParameter('action', 'off')->
- end()->
- with('response')->begin()->
- isStatusCode(200)->
- matches('#<h1>Lorem <strong>ipsum</strong> dolor sit amet.</h1>#')->
- matches('#<h2>Lorem <strong>ipsum</strong> dolor sit amet.</h2>#')->
- end()
+$b->get('/escaping/off')
+
+ ->with('request')->begin()
+ ->isParameter('module', 'escaping')
+ ->isParameter('action', 'off')
+ ->end()
+
+ ->with('response')->begin()
+ ->isStatusCode(200)
+ ->matches('#<h1>Lorem <strong>ipsum</strong> dolor sit amet.</h1>#')
+ ->matches('#<h2>Lorem <strong>ipsum</strong> dolor sit amet.</h2>#')
+ ->end()
;
Modified:
branches/1.4/test/functional/fixtures/apps/frontend/modules/escaping/actions/actions.class.php
===================================================================
---
branches/1.4/test/functional/fixtures/apps/frontend/modules/escaping/actions/actions.class.php
2010-02-08 19:54:57 UTC (rev 27754)
+++
branches/1.4/test/functional/fixtures/apps/frontend/modules/escaping/actions/actions.class.php
2010-02-08 20:51:02 UTC (rev 27755)
@@ -19,11 +19,11 @@
public function executeOn()
{
- sfConfig::set('sf_escaping_strategy', 'on');
+ sfConfig::set('sf_escaping_strategy', true);
}
public function executeOff()
{
- sfConfig::set('sf_escaping_strategy', 'off');
+ sfConfig::set('sf_escaping_strategy', false);
}
}
Added:
branches/1.4/test/functional/fixtures/apps/frontend/modules/escaping/templates/_partial1.php
===================================================================
---
branches/1.4/test/functional/fixtures/apps/frontend/modules/escaping/templates/_partial1.php
(rev 0)
+++
branches/1.4/test/functional/fixtures/apps/frontend/modules/escaping/templates/_partial1.php
2010-02-08 20:51:02 UTC (rev 27755)
@@ -0,0 +1,6 @@
+<h3><?php echo $var ?></h3>
+<h4><?php echo $sf_data->getRaw('var') ?></h4>
+
+<span class="<?php echo $sf_data->getRaw('arr') ? 'yes' : 'no' ?>"></span>
+
+<?php include_partial('escaping/partial2', array('var' => $var, 'arr' =>
$arr)) ?>
Property changes on:
branches/1.4/test/functional/fixtures/apps/frontend/modules/escaping/templates/_partial1.php
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Added:
branches/1.4/test/functional/fixtures/apps/frontend/modules/escaping/templates/_partial2.php
===================================================================
---
branches/1.4/test/functional/fixtures/apps/frontend/modules/escaping/templates/_partial2.php
(rev 0)
+++
branches/1.4/test/functional/fixtures/apps/frontend/modules/escaping/templates/_partial2.php
2010-02-08 20:51:02 UTC (rev 27755)
@@ -0,0 +1,4 @@
+<h5><?php echo $var ?></h5>
+<h6><?php echo $sf_data->getRaw('var') ?></h6>
+
+<span class="<?php echo $sf_data->getRaw('arr') ? 'yes' : 'no' ?>"></span>
Property changes on:
branches/1.4/test/functional/fixtures/apps/frontend/modules/escaping/templates/_partial2.php
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Modified:
branches/1.4/test/functional/fixtures/apps/frontend/modules/escaping/templates/indexSuccess.php
===================================================================
---
branches/1.4/test/functional/fixtures/apps/frontend/modules/escaping/templates/indexSuccess.php
2010-02-08 19:54:57 UTC (rev 27754)
+++
branches/1.4/test/functional/fixtures/apps/frontend/modules/escaping/templates/indexSuccess.php
2010-02-08 20:51:02 UTC (rev 27755)
@@ -1,2 +1,4 @@
<h1><?php echo $var ?></h1>
<h2><?php echo $sf_data->get('var') ?></h2>
+
+<?php include_partial('escaping/partial1', array('var' => $var, 'arr' =>
array())) ?>
--
You received this message because you are subscribed to the Google Groups
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/symfony-svn?hl=en.