I'm trying to use set_error_handler with a function name (in the global
scope -- not a class method), and I'm getting a seg-fault in PHP. I'm
wondering if it's a scope problem.

Here's an abbreviation of what I have:

(Main.php)

include_once('Error.php');
class Main {
  function main() {
    Main::_initDB();
  }
  funtion _initDB() {
    Error::setErrorHandler('_handleError');
  }
}

(Error.php)

function _handleError(...) {
  // handle the error here
}

class Error {
  function setErrorHandler($functionName) {
    set_error_handler($functionName);
  }
}

I'm wondering if there's a scope problem here. I haven't fully explored the
possibility that maybe my error-handling code is causing an error, but I'm
wondering if anyone else has had a problem like this. It seems that perhaps
PHP has a scope problem when I call set_error_handler() inside a class
method (it's a static method, but PHP doesn't know the diff).

Any thoughts?

Dean.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to