Skip to content

Commit c0676f3

Browse files
committed
minor #5597 [CreateFramework] don't override existing variables (xabbuh)
This PR was merged into the 2.3 branch. Discussion ---------- [CreateFramework] don't override existing variables | Q | A | ------------- | --- | Doc fix? | yes | New docs? | no | Applies to | all | Fixed tickets | #5568 When extracting the request attributes, existing variables must not be overridden so that the `$request` variable is passed to the template as is. Commits ------- 4b23fdc don't override existing variables
2 parents f452b6e + 4b23fdc commit c0676f3

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)