Skip to content

Commit 41e0081

Browse files
committed
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0: Fix #81475: stream_isatty emits warning with attached stream wrapper
2 parents 9fc6be2 + e2d9ca7 commit 41e0081

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ PHP NEWS
77
Doleček)
88
. Fixed bug #81380 (Observer may not be initialized properly). (krakjoe)
99

10+
- Streams:
11+
. Fixed bug #81475 (stream_isatty emits warning with attached stream wrapper).
12+
(cmb)
13+
1014
30 Sep 2021, PHP 8.1.0RC3
1115

1216
- Filter:
Lines changed: 10 additions & 0 deletions
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

Lines changed: 3 additions & 1 deletion
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)