Commit 6444124a authored by Fabien Potencier's avatar Fabien Potencier

added escaping to the examples in the doc

parent 89f1087a
......@@ -11,8 +11,8 @@ require_once __DIR__.'/silex.phar';
$app = new Silex\Application();
$app->get('/hello/{name}', function ($name) {
return "Hello $name";
$app->get('/hello/{name}', function ($name) use ($app) {
return 'Hello '.$app->escape($name);
});
$app->run();
......
......@@ -26,8 +26,8 @@ step.
$app = new Silex\Application();
$app->get('/hello/{name}', function ($name) {
return "Hello $name";
$app->get('/hello/{name}', function ($name) use ($app) {
return 'Hello '.$app->escape($name);
});
$app->run();
......
......@@ -257,9 +257,9 @@ class Application extends \Pimple implements HttpKernelInterface, EventSubscribe
* @param string $text The input text to be escaped
* @return string Escaped text
*/
public function escape($text)
public function escape($text, $flags = ENT_COMPAT, $charset = 'UTF-8', $doubleEncode = true)
{
return htmlspecialchars($text, ENT_COMPAT, 'UTF-8');
return htmlspecialchars($text, $flags, $charset, $doubleEncode);
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment