|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
c960657 Smarty Regular
Joined: 07 May 2003 Posts: 75 Location: Copenhagen, Denmark
|
Posted: Mon Feb 16, 2004 10:37 am Post subject: template_exists('file:foo.tpl') fails |
|
|
Calling $smarty_obj->template_exists('file:foo.tpl'), i.e. with an explicit 'file:' resource type, yields a PHP warning when the file foo.tpl does not exist:
Warning: filemtime(): Stat failed for /home/dr/www/xxx/templates/filter/default.tpl (errno=2 - No such file or directory) in /home/dr/www/smarty/Smarty.class.php on line 1572
In Smarty.class.php the lines 1571-1572 currently read:
Code: | $params['resource_timestamp'] = filemtime($_resource_name);
$_return = is_file($_resource_name);
|
This should be changed to something like
Code: | $_return = is_file($_resource_name);
$params['resource_timestamp'] = $_return ? filemtime($_resource_name) : null;
|
to make sure that filemtime() is only called when the file actually exists. |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Tue Feb 24, 2004 10:23 pm Post subject: |
|
|
Thanks for pointing this out!
my fix looks a bit different:
Code: | Index: libs/Smarty.class.php
===================================================================
RCS file: /repository/smarty/libs/Smarty.class.php,v
retrieving revision 1.478
diff -u -r1.478 Smarty.class.php
--- libs/Smarty.class.php 23 Feb 2004 23:14:40 -0000 1.478
+++ libs/Smarty.class.php 24 Feb 2004 22:17:33 -0000
@@ -1665,6 +1665,9 @@
}
}
return false;
+ } else {
+ /* absolute path */
+ return file_exists($params['resource_name']);
}
} elseif (empty($this->_plugins['resource'][$params['resource_type']])) {
$_params = array('type' => $params['resource_type']);
|
But it should fix the problem. If you like, please volunteer to test the CVS-version.
greetings
messju |
|
Back to top |
|
c960657 Smarty Regular
Joined: 07 May 2003 Posts: 75 Location: Copenhagen, Denmark
|
Posted: Wed Feb 25, 2004 10:16 am Post subject: |
|
|
messju wrote: | my fix looks a bit different |
It appears to solve my problem as well - thanks |
|
Back to top |
|
|
|
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
|