diff options
author | Christian Schneider | 2020-09-15 13:37:29 +0200 |
---|---|---|
committer | Christian Schneider | 2020-09-15 13:37:29 +0200 |
commit | 5359b07a5c61588c680894c9c5ddc7aa47deb275 (patch) | |
tree | 5264e0c06d2c30560fdddeb544710974f5fd22c1 | |
parent | 79fd50e172a50918d9018f54ab6e40606181f95b (diff) | |
download | itools-5359b07a5c61588c680894c9c5ddc7aa47deb275.tar.gz itools-5359b07a5c61588c680894c9c5ddc7aa47deb275.tar.bz2 itools-5359b07a5c61588c680894c9c5ddc7aa47deb275.zip |
Do not generate warning (PHP 8: TypeError) if STDERR is not a valid resource, e.g. in test/getopt.t because of backgrounding?!
-rw-r--r-- | it.class | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -929,7 +929,8 @@ static function getopt($usage, $p = array()) it::error("Optional arguments passed to script without optional args in usage"); # FIXME 2020-10 NG merge with normal usage errors below if ($err || $eat || $result['h'] || $result['help'] || $mandatoryargs) { - fputs(($result['h'] || $result['help'] ? STDOUT : STDERR), trim($usage) . "\n"); + if (is_resource($out = $result['h'] || $result['help'] ? STDOUT : STDERR)) + fputs($out, trim($usage) . "\n"); return $p['noexit'] ? false : exit(1); } |