Jump to content

customised error handler gives error message


Lassie

Recommended Posts

I am using a purpose built error handler for development and get an error message as follows:-

 

Warning: Wrong parameter count for print_r() in c:\easyserv\www\timeshare1\includes\config.inc.php on line 23

 

Can anyone help please.

 

<?php #  - config.inc.php

// This script determines how errors are handled.

// Flag variable for site status:
$live = TRUE;

// Error log email address:
$email = '[email protected]';

// Create the error handler.
function my_error_handler ($e_number, $e_message, $e_file, $e_line, $e_vars) {

global $live, $email;

// Build the error message.
$message = "An error occurred in script '$e_file' on line $e_line: \n<br />$e_message\n<br />";

// Add the date and time.
$message .= "Date/Time: " . date('n-j-Y H:i:s') . "\n<br />";

// Append $e_vars to the $message.//Line 23
$message .= print_r($e_vars,1);

if ($live) { // Don't show the specific error.

	error_log ($message, 1, $email); // Send email.

	// Only print an error message if the error isn't a notice.
	if ($e_number != E_NOTICE) {
		echo '<div id="Error">A system error occurred. We apologize for the inconvenience.</div><br />';
	}

} else { // Development (print the error).
	echo '<div id="Error">' . $message . '</div><br />';
}

} // End of my_error_handler() definition.

// Use my error handler.
set_error_handler ('my_error_handler');
?>

from the manual:

 

Version	Description
4.3.0	The return parameter was added. If you need to capture the output of print_r() with an older version of PHP prior, use the output-control functions.

 

see http://ca3.php.net/manual/en/function.print-r.php

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.