php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21094 set_error_handler not accepting methods
Submitted: 2002-12-19 04:11 UTC Modified: 2003-04-20 09:18 UTC
From: carl at thep dot lu dot se Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 5CVS-2003-01-19 (dev) OS: Linux
Private report: No CVE-ID: None
 [2002-12-19 04:11 UTC] 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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-02-02 15:38 UTC] 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

 [2003-04-18 16:50 UTC] 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-04-20 09:18 UTC] stas@php.net
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.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 03:01:29 2024 UTC