Bug #52935 [Opn]: call exit in user_error_handler cause stream relate core
| From: | felipe@php.net | Date: | Mon, 27 Sep 2010 21:42:21 +0000 |
| Subject: | Bug #52935 [Opn]: call exit in user_error_handler cause stream relate core | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-154678@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=52935&edit=1
ID: 52935
Updated by: felipe@php.net
Reported by: laruence at yahoo dot com dot cn
Summary: call exit in user_error_handler cause stream relate
core
Status: Open
Type: Bug
Package: Scripting Engine problem
Operating System: any
PHP Version: 5.2.14
Block user comment: N
New Comment:
Related to bug #52922
Previous Comments:
------------------------------------------------------------------------
[2010-09-27 17:31:32] laruence at yahoo dot com dot cn
Description:
------------
because in PHP exit is implements by set/longjmp
so the normal sequence
php_stream_wrapper_log_error
php_stream_display_wrapper_errors
-> php_error_docref1
php_stream_tidy_wrapper_error_log
when use set_error_handler, and call exit in use_handler,
cause the php_stream_tidy_wrapper_error_log to be miss called,
which cause wrap->err_count doesn't reset to zero after request
shutdown.
then cause the following code coredump in
php_stream_display_wrapper_errors
for (i = 0, l = 0; i < wrapper->err_count; i++) {
l += strlen(wrapper->err_stack[i]); //core
if (i < wrapper->err_count - 1) {
l += brlen;
}
}
Test script:
---------------
<?php
function err_handler(){
exit;
return true;
}
set_error_handler('err_handler');
$client = new
SoapClient("http://unreachable.com/ServiceNoWse.asmx?WSDL");
Expected result:
----------------
normal exit
Actual result:
--------------
core dump
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=52935&edit=1