Bug #52935 [NEW]: call exit in user_error_handler cause stream relate core
| From: | laruence at yahoo dot com dot cn | Date: | Mon, 27 Sep 2010 15:31:33 +0000 |
| Subject: | Bug #52935 [NEW]: call exit in user_error_handler cause stream relate core | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-154675@lists.php.net to get a copy of this message | ||
From:
Operating system: any
PHP version: 5.2.14
Package: Scripting Engine problem
Bug Type: Bug
Bug description:call exit in user_error_handler cause stream relate core
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 bug report at http://bugs.php.net/bug.php?id=52935&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=52935&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=52935&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=52935&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=52935&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=52935&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=52935&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=52935&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=52935&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=52935&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=52935&r=support
Expected behavior: http://bugs.php.net/fix.php?id=52935&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=52935&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=52935&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=52935&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52935&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=52935&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=52935&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=52935&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=52935&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=52935&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=52935&r=mysqlcfg