Page 1 of 1

{get_template_vars} and PHP 5.2.0

Posted: Wed Mar 21, 2007 5:37 am
by cyberman
Short info from german forum part.

A user made an update to PHP 5.2.1 and {get_template_vars} does not work anymore. Got this error
Catchable fatal error: Object of class stdClass could not be converted to string in ....get_template_vars.php on line 27
There must be important changes in PHP 5.2.x . foreach goes thru array and find objekt StdClass in $value. But this has no tostring functionality. The fix:

Code: Select all

function smarty_cms_function_get_template_vars($params, &$smarty)
{
        global $gCms;

        $tpl_vars = $gCms->smarty->get_template_vars();
        $str = '';
        foreach( $tpl_vars as $key => $value )
          {
            if (! is_object($value)) # Patch Andre wegen verändertem Verhalten von php Update auf 5.2 
              $str .= "$key = $value<br/>";
          }
        return $str;
}
Maybe one of devs can place this to svn.

PS: Will we see a CMSms 1.0.5? If yes, when?

Re: {get_template_vars} and PHP 5.2.0

Posted: Wed Apr 11, 2007 2:32 pm
by calguy1000
I fixed it (in svn).  It'll be out in the 1.0.6 (maybe?) version of CMS.

Re: {get_template_vars} and PHP 5.2.0

Posted: Wed Apr 11, 2007 2:40 pm
by cyberman
Thanks ...