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