Commit 7cd1c503 authored by Fabien Potencier's avatar Fabien Potencier

added missing escaping to docs

parent 6444124a
......@@ -96,9 +96,10 @@ Here is an example of such an extension::
public function register(Application $app)
{
$app['hello'] = $app->protect(function ($name) use ($app) {
$default = ($app['hello.default_name']) ? $app['hello.default_name'] : '';
$default = $app['hello.default_name'] ? $app['hello.default_name'] : '';
$name = $name ?: $default;
return "Hello $name";
return 'Hello '.$app->escape($name);
});
}
}
......@@ -118,6 +119,7 @@ You can now use this extension as follows::
$app->get('/hello', function () use ($app) {
$name = $app['request']->get('name');
return $app['hello']($name);
});
......
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