#21094 [Ver->Csd]: set_error_handler not accepting methods

From: Date: Sun, 20 Apr 2003 14:18:39 +0000
Subject: #21094 [Ver->Csd]: set_error_handler not accepting methods
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-37923@lists.php.net to get a copy of this message
ID: 21094 Updated by: stas@php.net -Reported By: tater at potatoe dot com +Reported By: carl at thep dot lu dot se -Status: Verified +Status: Closed Bug Type: Zend Engine 2 problem -Operating System: OS X 10.2, RedHat 8.0, W2k serv. +Operating System: Linux PHP Version: 5CVS-2003-01-19 (dev) New Comment: This bug has been fixed in CVS. In case this was a PHP problem, snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. In case this was a documentation problem, the fix will show up soon at http://www.php.net/manual/. In case this was a PHP.net website problem, the change will show up on the PHP.net site and on the mirror sites in short time. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2003-04-18 16:50:21] thekid at thekid dot de This can be fixed quite easily: Index: Zend/zend_builtin_functions.c =================================================================== RCS file: /repository/ZendEngine2/zend_builtin_functions.c,v retrieving revision 1.184 diff -u -r1.184 zend_builtin_functions.c --- Zend/zend_builtin_functions.c 8 Apr 2003 18:22:32 -0000 1.184 +++ Zend/zend_builtin_functions.c 18 Apr 2003 21:49:51 -0000 @@ -967,13 +967,21 @@ ZEND_FUNCTION(set_error_handler) { zval **error_handler; + char *error_handler_name; zend_bool had_orig_error_handler=0; if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &error_handler)==FAILURE) { ZEND_WRONG_PARAM_COUNT(); } - convert_to_string_ex(error_handler); + if (!zend_is_callable(*error_handler, 0, &error_handler_name)) { + zend_error(E_WARNING, "%s() expects argument 1, '%s', to be a valid callback", + get_active_function_name(TSRMLS_C), error_handler_name); + efree(error_handler_name); + return; + } + efree(error_handler_name); + if (EG(user_error_handler)) { had_orig_error_handler = 1; *return_value = *EG(user_error_handler); ------------------------------------------------------------------------ [2003-02-02 15:38:20] k.schroeder@php.net tests/lang/bug21094.phpt also failed on W2k server: ---- EXPECTED OUTPUT [1024] errstr: test, errfile: %s, errline: %d ---- ACTUAL OUTPUT Notice: test in D:\work\php5\tests\lang\bug21094.php on line 10 ---- FAILED ------------------------------------------------------------------------ [2002-12-19 04:11:08] carl at thep dot lu dot se The set_error_handler() function is not accepting class methods as of the php4-ze2 CVS code from 19-Dec-2002. It does work with php 4.3 and ZE1. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=21094&edit=1

« previous php.bugs (#37923) next »