think we have this script :
class String {
protected $text = null;
public function __construct($text){
$this->text = $text;
}
public function __get($var){ return $this->$var; }
public function replace($search, $replace, $limit = -1, $ignoreCase = false){
extract($GLOBALS, EXTR_REFS);
return preg_replace($search, $replace, $this->text, $limit, $count);
}
}
class Setting {
private $active = "not active";
public function __get($var){
return $this->$var;
}
}
$s = new Setting;
function replace(){
$string = new String('System is [var:$s->active]');
echo $string->replace('/\[var:([^\]]+)\]/ie', 'isset(\1)? \1: "";');
}
replace();
now $active
property will not evaluate
is it a bug or i should do something special ?
SOLVED
with a lot of thanks to dear Artefacto.
the problem was solved
i should implement __isset
to use isset
function for readonly property