1--TEST--
2Test posix_ttyname() with wrong parameters
3--DESCRIPTION--
4Gets the absolute path to the current terminal device that is open on a given file descriptor.
5Source code: ext/posix/posix.c
6
7--CREDITS--
8Falko Menge, mail at falko-menge dot de
9PHP Testfest Berlin 2009-05-10
10--EXTENSIONS--
11posix
12standard
13--FILE--
14<?php
15
16var_dump(posix_ttyname(0)); // param not a resource
17
18$descriptors = [["pty"], ["pty"], ["pty"], ["pipe", "w"]];
19$pipes = [];
20$process = proc_open('echo "foo";', $descriptors, $pipes);
21
22try {
23    var_dump(posix_ttyname($process)); // wrong resource type
24} catch (TypeError $e) {
25    echo $e->getMessage(), "\n";
26}
27?>
28--EXPECT--
29bool(false)
30posix_ttyname(): supplied resource is not a valid stream resource
31