PDA

View Full Version : Quercus + Smarty


Jurgen
11-27-2011, 08:18 AM
Hello forum,

I'm in the process of setting up my webserver and I've run into a problem using Smarty together with Quercus. My server is a CentOS 5.7 machine with Apache Tomcat 7.0.22 and quercus 4.0.18. I'm also using Smarty 3.1.5. These are all the latest I think.

Everything is configured to work and I get a nice Quercus page when I run <?php phpinfo(); ?>. But when I run my website I get the following error:

/website/2011-11-27/includes/smarty/Smarty.class.php:643: Notice: Undefined property: Smarty::$cache_id /website/2011-11-27/includes/smarty/Smarty.class.php:643: Notice: Undefined property: Smarty::$compile_id /website/2011-11-27/includes/smarty/Smarty.class.php:643: Notice: Undefined property: Smarty::$parent

Is there a way to solve this? I can suppress the notice using error_reporting(0);but that doesn't make my page show up.

Thanks for your help,
Jurgen

Jurgen
11-29-2011, 09:06 PM
I've also asked this same question on the Smarty forum and have gotten only a single response saying "Sorry can't fix this".

Also, sorry for the shitty layout in the above post. The error looks more readable this way:
/website/2011-11-27/includes/smarty/Smarty.class.php:643: Notice: Undefined property: Smarty::$cache_id
/website/2011-11-27/includes/smarty/Smarty.class.php:643: Notice: Undefined property: Smarty::$compile_id
/website/2011-11-27/includes/smarty/Smarty.class.php:643: Notice: Undefined property: Smarty::$parent

I've found out that these errors are generated by Smarty, not by PHP. The code looks like this:

/**
* <<magic>> Generic getter.
*
* Calls the appropriate getter function.
* Issues an E_USER_NOTICE if no valid getter is found.
*
* @param string $name property name
* @return mixed
*/
public function __get($name)
{
$allowed = array(
'template_dir' => 'getTemplateDir',
'config_dir' => 'getConfigDir',
'plugins_dir' => 'getPluginsDir',
'compile_dir' => 'getCompileDir',
'cache_dir' => 'getCacheDir',
);

if (isset($allowed[$name])) {
return $this->{$allowed[$name]}();
} else {
trigger_error('Undefined property: '. get_class($this) .'::$'. $name, E_USER_NOTICE);
}
}

I haven't really looked that much into the code just yet. It would be hard anyway because there isn't really all that much wrong with it. This version of Smarty and my code work fine on standard PHP. So I don't know where to look and what to look for.

At this moment I'm considering ditching Smarty all together and rewriting my website.

domdorn
12-02-2011, 10:00 AM
its a problem with our isset() implementation - its a little messed up right now.

Jurgen
12-11-2011, 06:17 PM
Thanks for replying. I've tried a couple of things to get it working but couldn't do it. I also tried several old version of Smarty going back to the 2.x major version but none worked (The error changed sometimes but none of the versions worked).

I've solved the problem now by throwing away Smarty and writing my own component that does the same thing. Mine isn't nearly as feature rich as Smarty but I only need a few features. The website appears to work fine now.

I'm also happy to report that I use the Simple Machines Forum which appears to function fine as well. I only have one issue left where I get a jsessionid and a phpsessionid. Its cosmetic but it would be nice if that jsessionid wasn't there. Gonna hunt around on the forum a bit :). Maybe its a tomcat thing...

Thanks for replying
Jurgen

Jurgen
12-11-2011, 07:09 PM
Spoke too soon. Session handling for the admin section doesn't work right in the forum.