From 4b23fdc6d2953c0783d4f9ea9f1fbb754464b691 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 4 Aug 2015 23:23:31 +0200 Subject: [PATCH] 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. --- create_framework/templating.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/create_framework/templating.rst b/create_framework/templating.rst index 987a9ea26d1..43e77f92623 100644 --- a/create_framework/templating.rst +++ b/create_framework/templating.rst @@ -41,7 +41,7 @@ rendered:: function render_template($request) { - extract($request->attributes->all()); + extract($request->attributes->all(), EXTR_SKIP); ob_start(); include sprintf(__DIR__.'/../src/pages/%s.php', $_route); @@ -110,7 +110,7 @@ Here is the updated and improved version of our framework:: function render_template($request) { - extract($request->attributes->all()); + extract($request->attributes->all(), EXTR_SKIP); ob_start(); include sprintf(__DIR__.'/../src/pages/%s.php', $_route);