Edit report at http://bugs.php.net/bug.php?id=52935&edit=1
ID: 52935
User updated by: laruence at yahoo dot com dot cn
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:
there is some prombles in the example ,
1. the domain must be a valid domain
2. the envrion must can't connect to the internet
<?php
function err_handler(){
exit;
return true;
}
set_error_handler('err_handler');
$client =
file_get_contents("http://www.laruence.com/ServiceNoWse.asmx?WSDL");
Previous Comments:
------------------------------------------------------------------------
[2010-09-27 23:42:21] [email protected]
Related to bug #52922
------------------------------------------------------------------------
[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