Created
May 8, 2014 13:58
-
-
Save Rayne/837b7e9eefef969eaaab to your computer and use it in GitHub Desktop.
F3 Escaping Problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$root = dirname(__DIR__) . '/'; | |
/** @var $fw \Base */ | |
$fw = require $root . 'vendor/bcosca/fatfree/lib/base.php'; | |
$fw->set('CACHE', 'folder=' . __DIR__ . '/tmp/cache/'); | |
$fw->set('CASELESS', false); | |
$fw->set('DEBUG', 2); | |
$fw->set('TEMP', __DIR__ . '/tmp/'); | |
$fw->set('UI', __DIR__ . '/'); | |
$fw->set('value', '<p><span style="color:red;">R</span><span style="color:green;">G</span><span style="color:blue;">B</span> when not escaped</p>'); | |
// Escapes `value` and stores the result as `value_escaped`. | |
$value_escaped = Template::instance()->render('value.html'); | |
$fw->set('value_escaped', $value_escaped); | |
// Prints `value_escaped` as RAW text. | |
// Expected: escaped `value`. | |
// Result: non-escaped `value`. | |
$value_result = Template::instance()->render('master.html'); | |
echo '<h1>Expected (escaped `value`)</h1>'; | |
echo $value_escaped; | |
echo '<h1>Result (non-escaped `value` instead of escaped `value_escaped`)</h1>'; | |
echo $value_result; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{ @value_escaped | raw }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1>Expected (escaped `value`)</h1><p><span style="color:red;">R</span><span style="color:green;">G</span><span style="color:blue;">B</span> when not escaped</p><h1>Result (non-escaped `value` instead of escaped `value_escaped`)</h1><p><span style="color:red;">R</span><span style="color:green;">G</span><span style="color:blue;">B</span> when not escaped</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{ @value }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment