Skip to content

Commit

Permalink
Fix posix test
Browse files Browse the repository at this point in the history
  • Loading branch information
kocsismate committed Aug 4, 2020
1 parent bfdbb90 commit 040b5e7
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions ext/posix/tests/posix_ttyname_error_wrongparams.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,21 @@ PHP Testfest Berlin 2009-05-10
if (!extension_loaded('posix')) {
die('SKIP - POSIX extension not available');
}
if (!extension_loaded('sockets')) {
die('SKIP - Sockets extension not available');
if (!extension_loaded('standard')) {
die('SKIP - Standard extension not available');

This comment has been minimized.

Copy link
@carusogabriel

carusogabriel Aug 4, 2020

Contributor

This condition is always false, the standard extension is always loaded.

}
?>
--FILE--
<?php

var_dump(posix_ttyname(0)); // param not a resource

$descriptors = [["pty"], ["pty"], ["pty"], ["pipe", "w"]];
$pipes = [];
$process = proc_open('echo "foo";', $descriptors, $pipes);

try {
var_dump(posix_ttyname(finfo_open(FILEINFO_NONE, __DIR__))); // wrong resource type
var_dump(posix_ttyname($process)); // wrong resource type
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
Expand Down

0 comments on commit 040b5e7

Please sign in to comment.