mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-06 11:24:27 +02:00
fix __get() return value, and set properties before returning
This commit is contained in:
@@ -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) {
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
Reference in New Issue
Block a user