[PHPTAL] a little bug

mlists at c-net.it mlists at c-net.it
Tue May 16 13:42:21 CEST 2006


just an example run this code

$cmd = 'hello';
unset($cmd)

$tpl->set($cmd, 'world');


how to fix it

    /**
     * Context setter.
     */
    public function __set($varname, $value)
    {
/* workaround */
if ( !isset($varname) )
return
/* workaround */

        if ($varname[0] == '_'){
            $e = 'Template variable error \'%s\' must not begin with underscore';
            $e = sprintf($e, $varname);
            throw new Exception($e);
        }
        $this->$varname = $value;
    }





More information about the PHPTAL mailing list