1--TEST--
2fclose() actually closes streams with refcount > 1
3--FILE--
4<?php
5$s = fopen(__FILE__, "rb");
6function separate_zval(&$var) { }
7$s2 = $s;
8separate_zval($s2);
9fclose($s);
10try {
11    echo fread($s2, strlen("<?php"));
12} catch (TypeError $e) {
13    echo $e->getMessage(), "\n";
14}
15echo "\nDone.\n";
16?>
17--EXPECT--
18fread(): supplied resource is not a valid stream resource
19
20Done.
21