10000 don't override existing variables · symfony/symfony-docs@4b23fdc · GitHub
[go: up one dir, main page]

Skip to content

Commit 4b23fdc

Browse files
committed
don't override existing variables
When extracting the request attributes, existing variables must not be overridden so that the `$request` variable is passed to the template as is.
1 parent bde40f9 commit 4b23fdc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

create_framework/templating.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ rendered::
4141

4242
function render_template($request)
4343
{
44-
extract($request->attributes->all());
44+
extract($request->attributes->all(), EXTR_SKIP);
4545
ob_start();
4646
include sprintf(__DIR__.'/../src/pages/%s.php', $_route);
4747

@@ -110,7 +110,7 @@ Here is the updated and improved version of our framework::
110110

111111
function render_template($request)
112112
{
113-
extract($request->attributes->all());
113+
extract($request->attributes->all(), EXTR_SKIP);
114114
ob_start();
115115
include sprintf(__DIR__.'/../src/pages/%s.php', $_route);
116116

0 commit comments

Comments
 (0)
0