|
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 |
vvviop Smarty n00b
Joined: 20 Oct 2010 Posts: 1
|
Posted: Wed Oct 20, 2010 4:10 am Post subject: include_php and trusted_dir in smarty3 has an error |
|
|
index.php
Code: |
<?php
$smarty = new Smarty();
$smarty->template_dir = 'template_dir' ;
$smarty->compile_dir = 'compile_dir' ;
$smarty->trusted_dir = 'trusted_dir' ;
$smarty->display ( 'index.tpl' );
|
template_dir/index.tpl
Code: |
hello smarty!
{include_php file='a.php'}
|
trusted_dir/a.php
Code: |
<?php
print 'im a.php' ;
|
Fatal error:
include_php: file "'a.php'" is not readable' |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Wed Oct 20, 2010 1:51 pm Post subject: |
|
|
is it readable? can PHP access the file? Check perms on the file and the trusted_dir. See that the $smarty->trusted_dir is the setting you expect. you might try a test from PHP:
file_get_contents($smarty->trusted_dir .'/a.php');
see if that errors. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Wed Oct 20, 2010 7:26 pm Post subject: |
|
|
This is a backward compatibillity problem to Smarty2 because of some changes in Smarty3 security.
$smarty->trusted_dir is not used as in Smarty2 for {include_php}
For the moment use in {include_php } an absolute filepath or a path relative to your script should also work.
I must take a more detailed look into it for a general solution. |
|
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
|