Do not log supressed PHP Warning -


is there way find out if warning supressed or not using set_error_handler() function? code 2 @somethingwrong() , somethingwrong(). don't want log warnings. example functions gzuncompress() must handled way because have no way test valid input data.

$handler = new errorhandler(); error_reporting(0); set_error_handler(array($handler, 'handle')); set_exception_handler(array($handler, 'exception')); register_shutdown_function(array($handler, 'shutdown'));  class errorhandler { public function handle($code, $text, $file, $line) {     if (($code & (e_strict | e_notice)) == 0)         $this->log(...); }  public function exception($exception) {     ... }  public function shutdown() {     $e = error_get_last();     if ($e !== null)         $this->log($error); } }  // errors include('notexisting.file'); // should logged @gzuncompress('somenonsens'); // should not logged 

did try it? think if use @ in @gzuncompress not normal warning , not have errorhandler called.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -