
July 6th, 2005, 01:37 PM
|
|
Contributing User
|
|
Join Date: Apr 2007
Posts: 84
Time spent in forums: 3 h 37 m 55 sec
Reputation Power: 2
|
|
|
error handler
Hello All,
I am trying to incorporate PHP error handling as well as PEAR error handling. It's driving me nuts...
Here is my code.
php Code:
Original
- php Code |
|
|
|
// this function will handle all errors reported by PHP function php_error_handler ($errno, $errstr, $errfile, $errline) { die ("In $errfile, line: $errlinen<br>$errstr"); } // this function will catch errors generated by Pear, // transform it to PHP errors and trigger them to the php_error_handler function pear_error_handler ($err_obj) { $error_string = $err_obj->getMessage() . '<br>' . $error_obj->getDebugInfo(); } require 'DB.php'; PEAR::setErrorHandling (PEAR_ERROR_CALLBACK, 'pear_error_handler'); $host = 'localhost'; $user = 'A'; $pass = 'B'; $db_name = 'C'; $dsn = "mysql://$user:$pass@$host/$db_name"; $db = DB::connect($dsn, false);
If I run the above code, I get:
In D:phpPEARDB.php, line: 470
Assigning the return value of new by reference is deprecated
If I remove the PHP error handler, PEAR runs fines.
I would like to have both. Is it possible??
I have PHP 5.04 and PEAR:  B 1.7.6
|