Ben yöntemlerle bir sınıf var __ toString ve __ almak ve bu "mesajı" olarak korunan bazı özellikleri. Şimdiye kadar, çok iyi.
Sorun şimdi ben toString __ in $ this-> mesajı erişmek için gereken olduğunu, ve bu (ama her zaman değil GENELLİKLE) (aşağıdaki örneğe bakın) $ display_all true ayarlanmış bir segment hataya neden olur. Neden ve nasıl düzeltebilirim biliyor musunuz?
Thanks a lot ! Rolf
PS: Burada bir örnek
class FuckedClass {
protected $file;
protected $line;
protected $display_all;
protected $message;
//[...]
/**
* Magic getter
* @param String $name
* @return mixed
*/
public function __get($name) {
return (in_array($name,array_keys(get_class_vars(__CLASS__))))?
$this->$name : null;
}
/**
* Formats
*/
public function __toString() {
$message = $this->message . ($this->display_all) ?
'[ Location: '.$this->file.' @ line '.$this->line.' ]':
'';
$text =<<<PLAIN
Error : {$message}
PLAIN;
return $text;
}
}
//instantiated $fucked_class
die($fucked_class);