Bug #7620 [Fbk->NoF]: Flexy compiler tries to write out of copiled dir

From: Date: Mon, 23 Mar 2009 16:57:18 +0000
Subject: Bug #7620 [Fbk->NoF]: Flexy compiler tries to write out of copiled dir
References: 1  Groups: php.pear.bugs 
Request: Send a blank email to pear-bugs+get-235@lists.php.net to get a copy of this message
Edit report at http://pear.php.net/bugs/bug.php?id=7620&edit=1 ID: 7620 Updated by: daniel.oconnor@gmail.com Reported By: zx2001 at mail dot ru Summary: Flexy compiler tries to write out of copiled dir -Status: Feedback +Status: No Feedback Type: Bug Package: HTML_Template_Flexy Operating System: Any Package Version: 1.2.4 PHP Version: Irrelevant Roadmap Versions: New Comment: -Status: Feedback +Status: No Feedback Previous Comments: ------------------------------------------------------------------------ [2007-01-09 00:43:44] alan_k I think the real solution here is to use realpath somewhere, and find out the resolved path, then try and match one of the source folders, subtract that from the path... I cant even rememeber how it decides to name the folders if you are using multiple paths (AFAIR it may do some md5 hashing)... ------------------------------------------------------------------------ [2006-06-02 05:34:37] zx2001 at mail dot ru This construct used when we have multiSource = true and use template 'iheritance', i.e. /themes/default/templates - filled with 'default' templates /themes/specific/templates - filled with couple of templates which overrides default templates. Flexy source dir set to array(/themes/specific/templates, /themes/default/templates) so it uses template from default if it's missing from specific. This allows very flexible theme definition when we just override templates which require modification. Now, if we want override some template, but not completely, just adding decoration html before and after, we use: html before.... <flexy:include src="../../default/templates/abstractproductspagelet.html"/> <!-- includes default template --> html after. And it works fine except for compiled file location. I hope this explains why relative pathes is important. Or another way to include template out of current template directory will be helpful. Thanks for you hard work. Max. ------------------------------------------------------------------------ [2006-06-02 00:09:55] alan_k unfortuatly, that may lead to collisions. I suspect the real solution is to ban relative paths. ------------------------------------------------------------------------ [2006-05-13 09:05:34] zx2001 at mail dot ru Description: ------------ Flexy compiler tries to write out of copiled dir when using construction like: <flexy:include src="../../default/templates/abstractproductspagelet.html"/> Note "../../" exists in the path, flexy goes out of compiled dir, this leads to permission errors or invalid compiled file location. As a temporary solution, I modified HTML/Template/Flexy.php near line 362 - forced it to remove "../". // Ensure we don't go out of compile dir. $__file = preg_replace('/\\.\\.\\//', '', $file); $base = $compileDest . $compileSuffix . DIRECTORY_SEPARATOR .$__file; Test script: --------------- <flexy:include src="../../default/templates/abstractproductspagelet.html"/> ------------------------------------------------------------------------ -- Edit this bug report at http://pear.php.net/bugs/bug.php?id=7620&edit=1

« previous php.pear.bugs (#235) next »