PHP Class BugReporter

An object for sending captured error info to an HTTP server. An object for sending captured error info to an HTTP server. In particular this is made to work with the Trac plugin Autotrac, though it would be quite simple to make another HTTP server to work with it. A simple way to use this object is to create an error handler to the following function report_bug(): function report_bug ($p_number, $p_string, $p_file, $p_line) { $reporter = new BugReporter ($p_number, $p_string, $p_file, $p_line); $reporter->setServer ("http://myserver.com/mydirectory") $reporter->sendToServer(); } The errors are always sent to the server URL plus the extension "/report". So the above example would POST the error variables to http://myserver.com/mydirectory/newreport . The error variables POSTed are: - f_backtrace - f_id - f_software - f_str - f_num - f_file - f_line - f_backtrace * - f_description - f_email
Afficher le fichier Open project: sourcefabric/newscoop Class Usage Examples

Méthodes publiques

Méthode Description
__construct ( integer $p_number, string $p_string, string $p_file, integer $p_line, string $p_software, integer $p_version, string $p_time = "", mixed $p_backtrace = "" )
__convertBacktraceArrayToString ( array $p_backtrace ) : string Convert the backtrace array into a backtrace string.
getBacktraceString ( ) : string Get the backtrace string.
getDescription ( ) : integer Get the error reporter's description of the error.
getEmail ( ) : integer Get the error reporter's email address
getErrorNum ( ) : integer Get the number of the error.
getFile ( ) : string Get the name of the file in which the error occerrud.
getFileWithoutPath ( ) : string Return the name of the error-file, not including the path.
getFormToken ( $p_client ) : mixed Get form token to protect against CSRF attacks.
getId ( ) : string Get the Error ID Code
getLine ( ) : integer Get the line number the error occurred in.
getPHPVersion ( ) : string Gets PHP version
getPingStatus ( ) : The
getServer ( ) : string Returns the current developers' server.
getServerOS ( ) : string Gets OS info
getSoftware ( ) : string Get the name of the software the error occurred in.
getStr ( ) : The Get the error message
getTime ( ) : string Get the time of the error.
getVersion ( ) : string Get the version of the software the error occurred in.
setBacktraceString ( $p_backtrace ) : void Get Manually set the backtrace string.
setDescription ( $p_description ) : void Set the reporter's description of the error
setEmail ( $p_email ) : void Set the error reporter's email address.
setErrorNum ( $p_errorNum ) : void Manually set the number of the error which occurred.
setFile ( $p_file ) : void Manually set the file in which the error occurred.
setLine ( $p_line ) : void Manually set the line number in which the error occurred.
setPingStatus ( $p_pingingStatus ) : void When pinging status is is set to false, pingServer() returns true without actually pinging the server.
setServer ( string $p_server ) : void This changes the developers' default server.
setSoftware ( $p_software ) : void Manually set the software in which the error occurred.
setStr ( $p_str ) : void Manually set the message of the error which occurred.
setTime ( $p_time ) : void Manually set the time at which the error occurred.
setVersion ( $p_version ) : void Manually set the software version of the error which occurred.

Method Details

__construct() public méthode

public __construct ( integer $p_number, string $p_string, string $p_file, integer $p_line, string $p_software, integer $p_version, string $p_time = "", mixed $p_backtrace = "" )
$p_number integer The PHP error number.
$p_string string The error message.
$p_file string The file which encountered the error.
$p_line integer The line number of the file which encountered the error.
$p_software string The name of the software that encountered an error.
$p_version integer The version of the software that encountered an error.
$p_time string The date and time. If left blank, it is the current date and time.
$p_backtrace mixed The stack trace. This can be an array or string.

__convertBacktraceArrayToString() public méthode

Convert the backtrace array into a backtrace string.
public __convertBacktraceArrayToString ( array $p_backtrace ) : string
$p_backtrace array array The array to be converted.
Résultat string The array as a string.

getBacktraceString() public méthode

Get the backtrace string.
public getBacktraceString ( ) : string
Résultat string The traceback

getDescription() public méthode

Get the error reporter's description of the error.
public getDescription ( ) : integer
Résultat integer Get the user's description of the error

getEmail() public méthode

Get the error reporter's email address
public getEmail ( ) : integer
Résultat integer Get the email address of the user.

getErrorNum() public méthode

Get the number of the error.
public getErrorNum ( ) : integer
Résultat integer The error number

getFile() public méthode

Get the name of the file in which the error occerrud.
public getFile ( ) : string
Résultat string The name of the file the crash occurred in.

getFileWithoutPath() public méthode

Return the name of the error-file, not including the path.
public getFileWithoutPath ( ) : string
Résultat string The name of the file, not including the path.

getFormToken() public méthode

Get form token to protect against CSRF attacks.
public getFormToken ( $p_client ) : mixed
Résultat mixed String The form token False If the no token was get.

getId() public méthode

Get the Error ID Code
public getId ( ) : string
Résultat string the file's ID-code.

getLine() public méthode

Get the line number the error occurred in.
public getLine ( ) : integer
Résultat integer The line number the error occurred in.

getPHPVersion() public méthode

Gets PHP version
public getPHPVersion ( ) : string
Résultat string php version

getPingStatus() public méthode

public getPingStatus ( ) : The
Résultat The pinging status

getServer() public méthode

Returns the current developers' server.
public getServer ( ) : string
Résultat string The current server's URL.

getServerOS() public méthode

Gets OS info
public getServerOS ( ) : string
Résultat string OS info

getSoftware() public méthode

Get the name of the software the error occurred in.
public getSoftware ( ) : string
Résultat string The name of the software the error occurred in.

getStr() public méthode

Get the error message
public getStr ( ) : The
Résultat The error-string

getTime() public méthode

Get the time of the error.
public getTime ( ) : string
Résultat string The time at which the crash occurred

getVersion() public méthode

Get the version of the software the error occurred in.
public getVersion ( ) : string
Résultat string The version of the software the error occurred in

setBacktraceString() public méthode

Get Manually set the backtrace string.
public setBacktraceString ( $p_backtrace ) : void
Résultat void

setDescription() public méthode

Set the reporter's description of the error
public setDescription ( $p_description ) : void
Résultat void

setEmail() public méthode

Set the error reporter's email address.
public setEmail ( $p_email ) : void
Résultat void

setErrorNum() public méthode

Manually set the number of the error which occurred.
public setErrorNum ( $p_errorNum ) : void
Résultat void

setFile() public méthode

Manually set the file in which the error occurred.
public setFile ( $p_file ) : void
Résultat void

setLine() public méthode

Manually set the line number in which the error occurred.
public setLine ( $p_line ) : void
Résultat void

setPingStatus() public méthode

When pinging status is is set to false, pingServer() returns true without actually pinging the server.
public setPingStatus ( $p_pingingStatus ) : void
Résultat void

setServer() public méthode

This changes the developers' default server.
public setServer ( string $p_server ) : void
$p_server string The URL of the new server.
Résultat void

setSoftware() public méthode

Manually set the software in which the error occurred.
public setSoftware ( $p_software ) : void
Résultat void

setStr() public méthode

Manually set the message of the error which occurred.
public setStr ( $p_str ) : void
Résultat void

setTime() public méthode

Manually set the time at which the error occurred.
public setTime ( $p_time ) : void
Résultat void

setVersion() public méthode

Manually set the software version of the error which occurred.
public setVersion ( $p_version ) : void
Résultat void