From 591df13a266d12a865378ea3689a69585d435706 Mon Sep 17 00:00:00 2001 From: "monte.ohrt" Date: Sat, 20 Feb 2010 21:48:19 +0000 Subject: [PATCH] fix __get() return value, and set properties before returning --- libs/Smarty.class.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index 020ef762..09c8fe4f 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -662,11 +662,17 @@ class Smarty extends Smarty_Internal_Data { * @param string $name property name */ public function __get($name) { +echo "inside get\n"; if(in_array($name, array('register', 'unregister', 'utility', 'cache'))) { $class = "Smarty_Internal_" . ucfirst($name); - return new $class($this); - } - return false; + $this->$name = new $class($this); + return $this->$name; + } else if ($name == '_version') { + // Smarty 2 BC + $this->_version = self::SMARTY_VERSION; + return $this->_version; + } + return null; } /** @@ -733,4 +739,4 @@ function smartyAutoload($class) { } } -?> \ No newline at end of file +?>