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

Problem with assign and PHPinfo

 
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 -> General
View previous topic :: View next topic  
Author Message
bkahle
Smarty Rookie


Joined: 07 Jan 2006
Posts: 5

PostPosted: Sat Jan 07, 2006 8:55 am    Post subject: Problem with assign and PHPinfo Reply with quote

Hello,

I have a quite strange problem with Smarty verified on three different machines with different OS, Web-Server and PHP-Version.

I have a framework set up with Smarty and its works great. But when I try to insert the output of "phpinfo" into Smarty it is shown once and then my session is killed. I figured out that it has something to do with string itself.

My code is like this:

$smarty = get_smarty_object();

ob_start();
phpinfo();
$info = ob_get_contents();
ob_end_clean();

$smarty->assign("content", $info);


When I replace phpinfo() with something like "echo 'Hello World';" there is no problem. I broke done the output of phpinfo and figured out that the content "Array" was the problem. When I replace the string "Array" before assigning it, it works.

But this cannot be the solution. Is there a way to verify/escape a string before assigning it ? I tried the modifiers but that did not help.

Best regards,
Bjoern Kahle
Back to top
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Sat Jan 07, 2006 10:21 am    Post subject: Reply with quote

Hi.

What happens if you do this alone in a template:

{null|phpinfo}

?
Back to top
View user's profile Send private message
bkahle
Smarty Rookie


Joined: 07 Jan 2006
Posts: 5

PostPosted: Sat Jan 07, 2006 10:53 am    Post subject: Reply with quote

Fatal error: Smarty error: [in system_check.tpl line 121]: syntax error: unrecognized tag 'null' (Smarty_Compiler.class.php, line 580) in Smarty.class.php on line 1095

I know I could get the info via php code, but I'm not allowed to put any "busines logic" into the templates.
Back to top
View user's profile Send private message
bkahle
Smarty Rookie


Joined: 07 Jan 2006
Posts: 5

PostPosted: Mon Jan 09, 2006 4:35 pm    Post subject: Reply with quote

I've found my problem, which did not have to do with Smarty apart.

I store my sessions in a database because this is more secure in a shared-hosting environment. The data field had the type "text" which has been to short for the data produced by my script. For debug purposes I store the last smarty object in the session. Filled with the output of "phpinfo" the session did not have enough space to write the data into the db.

So, no problem with smarty, only problem with coder Wink
Back to top
View user's profile Send private message
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 -> General 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