Login   Register  
PHP Classes
elePHPant
Icontem

Simple error handling class: Intercept and log PHP execution errors

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Info   View files View files (2)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings  
2012-03-03 (2 years ago) RSS 2.0 feedNot enough user ratingsTotal: 1,799 This week: 1All time: 2,032 This week: 1,398Up
Version License PHP version Categories  
errormanager 1.0GNU Lesser General Publ...5.0PHP 5, Logging
Description Author  

This class can be use to intercept and log PHP execution errors.

It can enable PHP execution error logging setting the file that logs error messages.

The class provides an error handler function that outputs a stack back-trace with the functions, arguments, file and lines of where an error occurs, as well the values of super-global variables $_GET, $_POST and $_FILES, and also the IP address of the current user accessing the site.

The class may also enable of disable the output of error messages to Web pages and change the error reporting level.

When used together with my Mysql class (or any other mysql class that calls trigger_error when there was mysql_error) it can effectively log all mysql errors with the complete stacktrace what you can inspect from the logfile later on.
Plus you can identify sql injections when someone's queries keep failing with error messages.

You can also specify error codes that exit the script execution plus your own callback function that will be called before exiting (good to display some nice error page to users before exiting script execution).

Picture of Indrek Altpere
Name: Indrek Altpere <contact>
Classes: 3 packages by
Country: Estonia Estonia
Age: 28
All time rank: 8012 in Estonia Estonia
Week rank: 1078 Down3 in Estonia Estonia Down

  Files folder image Files  
File Role Description
Accessible without login Plain text file ErrorManager.php Class Main class file
Accessible without login Plain text file test.php Example testing example

 Version Control Reuses Unique User Downloads Download Rankings  
 0%1Total:1,799All time:2,032
 This week:1This week:1,398Up