Php Magic Methods and Empty

wapiniLiz

New Member
Having the following code\[code\]class test { private $name; public function __get($name){ return $name; } public function __set($name,$value){ $this->name = $value; }}$obj = new test();$obj->a = 2;if (!empty($obj->a)) { echo 'not empty';}\[/code\]This is calling __isset. But this is not being defined so it always return empty. What is the best way to check for a non empty property?Update :changing the class is not a solution because it's a 3th party component and it has to remain intact.
 
Back
Top