{get_template_vars} and PHP 5.2.0

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
cyberman

{get_template_vars} and PHP 5.2.0

Post 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?
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: {get_template_vars} and PHP 5.2.0

Post by calguy1000 »

I fixed it (in svn).  It'll be out in the 1.0.6 (maybe?) version of CMS.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
cyberman

Re: {get_template_vars} and PHP 5.2.0

Post by cyberman »

Thanks ...
Post Reply

Return to “Developers Discussion”