xref: /PHP-8.1/ext/standard/tests/image/bug75708.phpt (revision 52aa0d9e)
1--TEST--
2Bug #75708 (getimagesize with "&$imageinfo" fails on StreamWrappers)
3--FILE--
4<?php
5
6class FSStreamWrapper {
7    function stream_open($file, $mode) {
8        $this->handle = fopen(str_replace('fs://', __DIR__ . '/', $file), $mode);
9        return true;
10    }
11    function stream_read($count) {
12        return fread($this->handle, $count);
13    }
14    function stream_eof() {
15        return feof($this->handle);
16    }
17    function stream_seek($offset, $whence) {
18        return fseek($this->handle, $offset, $whence) === 0;
19    }
20    function stream_stat() {
21        return fstat($this->handle);
22    }
23    function url_stat($file) {
24        return stat(str_replace('fs://', '', $file));
25    }
26    function stream_tell() {
27        return ftell($this->handle);
28    }
29    function stream_close() {
30        fclose($this->handle);
31    }
32}
33
34stream_register_wrapper('fs', 'FSStreamWrapper');
35
36var_dump(getimagesize('fs://bug75708.jpg', $info));
37
38?>
39--EXPECT--
40array(7) {
41  [0]=>
42  int(10)
43  [1]=>
44  int(10)
45  [2]=>
46  int(2)
47  [3]=>
48  string(22) "width="10" height="10""
49  ["bits"]=>
50  int(8)
51  ["channels"]=>
52  int(3)
53  ["mime"]=>
54  string(10) "image/jpeg"
55}
56
57