ID: 15791
Updated by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
-Status: Open
+Status: Analyzed
Bug Type: Feature/Change Request
Operating System: All
PHP Version: 4.1.1
New Comment:
This request is valid (it's a limitation of the current implementation
in zend_builtin_functions.c) but your analysis wasn't very accurat.
Methods of Static Classes or objects are normally passed with the
syntax array($obj, 'method'); or array('class', 'method');
Anyway, it's an open feature request.
Previous Comments:
------------------------------------------------------------------------
[2002-02-28 14:26:17] [EMAIL PROTECTED]
Heres the long and short of it: set_error_handler() wants a string as
the name of the function that will handle errors. However, if you
create a class and try to assign error handling to a function within
the class, there is no way to reference that function.
For example
class ApplicationObject {
var $error_List as array();
function ApplicationObject() {
set_error_handler('trapError');
}
function trapError($err_no, $err_str, $err_file, $err_line,
$err_context) {
echo "Trap error caught error ".$err_no;
}
}
// *** Now create the object ***
$app = new ApplicationObject();
trigger_error ("Cannot divide by zero", E_USER_ERROR);
This doesn't work. Nor does changing set_error_handler('trapError') to
set_error_handler('$this->trapError'). Removing the quotes just
executes the function. Removing the assignment of error handling
outside of the class like so:
$app = new ApplicationObject();
set_error_handler('$app->trapError');
trigger_error ("Cannot divide by zero", E_USER_ERROR);
Since the error handling function will need access to $error_List and I
sure dont want to GLOBAL it, this kind of makes things difficult.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=15791&edit=1