Skip to content

Commit 4a8ca72

Browse files
committed
Merge branch 'PHP-8.1'
* PHP-8.1: Fix #81475: stream_isatty emits warning with attached stream wrapper
2 parents c16f013 + 41e0081 commit 4a8ca72

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--TEST--
2+
Bug #81475 (stream_isatty emits warning with attached stream wrapper)
3+
--FILE--
4+
<?php
5+
$stdout = fopen('php://stdout', 'wb');
6+
stream_filter_append($stdout, 'string.toupper');
7+
var_dump(stream_isatty($stdout));
8+
?>
9+
--EXPECT--
10+
bool(false)

main/streams/cast.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,9 @@ PHPAPI int _php_stream_cast(php_stream *stream, int castas, void **ret, int show
293293
}
294294

295295
if (php_stream_is_filtered(stream)) {
296-
php_error_docref(NULL, E_WARNING, "Cannot cast a filtered stream on this system");
296+
if (show_err) {
297+
php_error_docref(NULL, E_WARNING, "Cannot cast a filtered stream on this system");
298+
}
297299
return FAILURE;
298300
} else if (stream->ops->cast && stream->ops->cast(stream, castas, ret) == SUCCESS) {
299301
goto exit_success;

0 commit comments

Comments
 (0)