#auto_error_handler # <?php # Error handler by bronco@warriordudimanche.net ################# function showline($line,$file){ $f=file($file);$r=''; for ($l=$line-2;$l<$line+2;$l++){ if (isset($f[$l])){ if ($l==$line-1){ $r.='<em style="color:white;text-shadow:0 0 2px black"><strong>'.$l.' >> </strong> '.$f[$l].'</em>'; }else{ $r.='<strong>'.$l.' >> </strong> '.$f[$l]; } } } return $r; } function error_handler($number, $message, $file, $line, $vars){ echo " <div style='word-wrap: break-word;Box-sizing: Border-box ;border-radius:5px;padding:15px;margin-bottom:20px;box-shadow:0 2px 1px maroon;font-family:courier;position:absolute;top:0;left:0;background-color:rgba(255,100,100,0.2);width:100%;height:auto;position:relative;min-width:320px;'> <h1 style='color:red;border-radius:5px;background-color:pink;padding:5px;box-shadow:0 2px 1px maroon'>Erreur $number</h1> <p style=''> <em>$message </em> a la ligne <strong style='font-size:24px'>$line</strong> dans le fichier <strong style='font-size:24px'>file: $file.</strong></p> <pre style='font-weight:bold;padding:20px;margin-left:10px;color:orange;text-shadow:0 1px 1px maroon;box-shadow:inset 0 2px 1px maroon;border-radius:5px;background-color:red;'><code>".showline($line,$file)."</pre></code> <h1 style='color:red;border-radius:5px;background-color:pink;padding:5px;box-shadow:0 2px 1px maroon'>Variables</h1> <pre style='overflow:scroll;height:200px;'>"; var_dump($vars) ; echo "</pre> <a style='display:block;text-align:right;font-size:14px;color:maroon;text-decoration:none;font-weight:bold;font-styl:italic;' href='http://warriordudimanche.net/'>Error handler par warriordudimanche.net</a> </div>"; if ( ($number !== E_NOTICE) && ($number < 2048) ) {die("Erreur fatale.");} } set_error_handler('error_handler'); ################################################################# ?>