Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Two errors when $smarty->compile_dir is not writable

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Bugs
View previous topic :: View next topic  
Author Message
c960657
Smarty Regular


Joined: 07 May 2003
Posts: 75
Location: Copenhagen, Denmark

PostPosted: Mon Jun 28, 2004 4:06 pm    Post subject: Two errors when $smarty->compile_dir is not writable Reply with quote

If $smarty->compile_dir is not writable by the web server, Smarty throws two errors:

Quote:
Error: Smarty error: unable to write to $compile_dir '/var/tmp/smarty/templates_c/foobar'. Be sure $compile_dir is writable by the web server user.

Warning: fetch(/var/tmp/smarty/templates_c/foobar/%%A5/A5E/A5EBF147%%header.tpl.php): failed to open stream: No such file or directory


I think only one error should be thrown - the second error is confusing. This can be fixed by changing Smarty::_compile_resource():
Code:
@@ -1420,9 +1420,7 @@

             $_params = array('compile_path'=>$compile_path, 'compiled_content' => $_compiled_content, 'resource_timestamp' => $_resource_timestamp);
             require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.write_compiled_resource.php');
-            smarty_core_write_compiled_resource($_params, $this);
-
-            return true;
+            return smarty_core_write_compiled_resource($_params, $this);
         } else {
             return false;
         }


This will make fetch() not try to include the non-existing compiled template.
Back to top
View user's profile Send private message Visit poster's website
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Mon Jun 28, 2004 4:19 pm    Post subject: Reply with quote

this suggestion sounds very reasonable to me.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Bugs All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP