php - Exception instead Notice -
i have 2 classes:
class test {   public $name; }  /*******/  class myclass {   private $_test = null;    __get($name)   {     return $this->$name;   }    __set($name,$value)   {     $this->$name = $value;   } }   and when want use way:
$obj1 = new myclass(); $obj1->_test = new test(); $obj1->_test->name = 'test!';   everything ok. possible, might use way:
$obj1 = new myclass(); $obj1->_test->name = 'test!';   then notice "notice: indirect modification of overloaded property myclass::$_test has no effect in /not_important_path_here". instead notice want throw exception. how it?
what you're looking errorexception object.
function exception_error_handler($no, $str, $file, $line ) { throw new errorexception($str, 0, $no, $file, $line); } set_error_handler("exception_error_handler");      
Comments
Post a Comment