main: refactor userstream method calling

Closes GH-19312
This commit is contained in:
Gina Peter Banyard 2025-07-30 14:47:59 +01:00
parent e5f81bd74c
commit 0992265611
4 changed files with 432 additions and 423 deletions

View file

@ -9,22 +9,19 @@ class wrapper {
return true;
}
function stream_eof() {
throw new exception();
throw new Exception('cannot eof');
}
}
stream_wrapper_register("wrap", "wrapper");
$fp = fopen("wrap://...", "r");
feof($fp);
echo "Done\n";
try {
feof($fp);
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECTF--
Warning: feof(): wrapper::stream_eof is not implemented! Assuming EOF in %s on line %d
Fatal error: Uncaught Exception in %s:%d
Stack trace:
#0 [internal function]: wrapper->stream_eof()
#1 %s(%d): feof(Resource id #%d)
#2 {main}
thrown in %s on line %d
--EXPECT--
Exception: cannot eof

View file

@ -65,5 +65,5 @@ ftruncate(): Argument #2 ($size) must be greater than or equal to 0
------ stream_truncate bad return: -------
truncation with new_size=0
Warning: ftruncate(): test_wrapper_bad::stream_truncate did not return a boolean! in %s on line %d
Warning: ftruncate(): test_wrapper_bad::stream_truncate value must be of type bool, string given in %s on line %d
bool(false)

View file

@ -28,5 +28,5 @@ $a = $zip->extractTo('teststream://test');
var_dump($a);
?>
--EXPECTF--
Warning: ZipArchive::extractTo(teststream://test/foo): Failed to open stream: "TestStream::stream_open" call failed in %s on line %d
Warning: ZipArchive::extractTo(teststream://test/foo): Failed to open stream: "TestStream::stream_open" is not implemented in %s on line %d
bool(false)

File diff suppressed because it is too large Load diff