1--TEST--
2Bug #54623: Segfault when when writing to a persistent socket after closing a copy of the socket
3--FILE--
4<?php
5$sock = pfsockopen('udp://127.0.0.1', '63844');
6var_dump((int)$sock);
7@fwrite($sock, "1");
8$sock2 = pfsockopen('udp://127.0.0.1', '63844');
9var_dump((int)$sock2);
10@fwrite($sock2, "2");
11fclose($sock2);
12try {
13    fwrite($sock, "3");
14} catch (TypeError $e) {
15    echo $e->getMessage(), "\n";
16}
17?>
18--EXPECTF--
19int(%d)
20int(%d)
21fwrite(): supplied resource is not a valid stream resource
22