xref: /PHP-8.2/Zend/tests/bug41421.phpt (revision 1b120b4a)
1--TEST--
2Bug #41421 (Uncaught exception from a stream wrapper segfaults)
3--FILE--
4<?php
5
6class wrapper {
7    public $context;
8    function stream_open() {
9        return true;
10    }
11    function stream_eof() {
12        throw new exception();
13    }
14}
15
16stream_wrapper_register("wrap", "wrapper");
17$fp = fopen("wrap://...", "r");
18feof($fp);
19
20echo "Done\n";
21?>
22--EXPECTF--
23Warning: feof(): wrapper::stream_eof is not implemented! Assuming EOF in %s on line %d
24
25Fatal error: Uncaught Exception in %s:%d
26Stack trace:
27#0 [internal function]: wrapper->stream_eof()
28#1 %s(%d): feof(Resource id #%d)
29#2 {main}
30  thrown in %s on line %d
31