ID: 31137
Updated by: [EMAIL PROTECTED]
Reported By: tony2001 at phpclub dot net
-Status: Open
+Status: Assigned
Bug Type: Filesystem function related
Operating System: Linux
PHP Version: 5CVS-2004-12-16 (dev)
-Assigned To:
+Assigned To: wez
Previous Comments:
------------------------------------------------------------------------
[2004-12-16 22:17:00] tony2001 at phpclub dot net
Description:
------------
Segfault when trying to remove stream filter *after* closing the stream
itself.
Wez, please, look into this, I don't have much time to debug it myself
ATM.
Reproduce code:
---------------
<?
//register some filter, it doesn't matter
stream_filter_register("f", "php_user_filter");
//open a stream
$fp = fopen("somefile.tmp", "w");
//append filter to the stream
$filter = stream_filter_append($fp, "f");
//write something
fwrite($fp, "something\n");
//we're closing the stream, but the filter is still there
fclose($fp);
//segfault when trying to remove filter
stream_filter_remove($filter);
?>
Expected result:
----------------
.
Actual result:
--------------
Program received signal SIGSEGV, Segmentation fault.
0x08141ef2 in _php_stream_filter_flush (filter=0x82c54bc, finish=1) at
/home/dev/php-src/main/streams/filter.c:418
418 if (!filter->chain || !filter->chain->stream) {
(gdb) bt
#0 0x08141ef2 in _php_stream_filter_flush (filter=0x82c54bc, finish=1)
at /home/dev/php-src/main/streams/filter.c:418
#1 0x081213c5 in zif_stream_filter_remove (ht=1,
return_value=0x82b2bfc, this_ptr=0x0, return_value_used=0)
at /home/dev/php-src/ext/standard/streamsfuncs.c:1143
#2 0x0818fb03 in zend_do_fcall_common_helper_SPEC
(execute_data=0xbfffd3c0) at zend_vm_execute.h:155
#3 0x08192531 in ZEND_DO_FCALL_SPEC_CONST_HANDLER
(execute_data=0xbfffd3c0) at zend_vm_execute.h:1514
#4 0x0818f81b in execute (op_array=0x82c0814) at zend_vm_execute.h:58
#5 0x0816cba7 in zend_execute_scripts (type=8, retval=0x0,
file_count=3) at /home/dev/php-src/Zend/zend.c:1062
#6 0x0812ce37 in php_execute_script (primary_file=0xbffff7d0) at
/home/dev/php-src/main/main.c:1639
#7 0x081dcb25 in main (argc=2, argv=0xbffff864) at
/home/dev/php-src/sapi/cli/php_cli.c:943
#8 0x420157a4 in __libc_start_main () from /lib/tls/libc.so.6
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=31137&edit=1