@@ -74,14 +74,14 @@ PHP_FUNCTION(stream_socket_pair)
74
74
close (pair [0 ]);
75
75
close (pair [1 ]);
76
76
php_error_docref (NULL , E_WARNING , "Failed to open stream from socketpair" );
77
- RETURN_FALSE ;
77
+ RETURN_FALSE ;
78
78
}
79
79
s2 = php_stream_sock_open_from_socket (pair [1 ], 0 );
80
80
if (s2 == NULL ) {
81
81
php_stream_free (s1 , PHP_STREAM_FREE_CLOSE );
82
82
close (pair [1 ]);
83
83
php_error_docref (NULL , E_WARNING , "Failed to open stream from socketpair" );
84
- RETURN_FALSE ;
84
+ RETURN_FALSE ;
85
85
}
86
86
87
87
array_init (return_value );
@@ -1645,10 +1645,14 @@ PHP_FUNCTION(stream_isatty)
1645
1645
1646
1646
php_stream_from_zval (stream , zsrc );
1647
1647
1648
- if (php_stream_can_cast (stream , PHP_STREAM_AS_FD_FOR_SELECT ) == SUCCESS ) {
1649
- php_stream_cast (stream , PHP_STREAM_AS_FD_FOR_SELECT , (void * )& fileno , 0 );
1650
- } else if (php_stream_can_cast (stream , PHP_STREAM_AS_FD ) == SUCCESS ) {
1651
- php_stream_cast (stream , PHP_STREAM_AS_FD , (void * )& fileno , 0 );
1648
+ /* get the fd.
1649
+ * NB: Most other code will NOT use the PHP_STREAM_CAST_INTERNAL flag when casting.
1650
+ * It is only used here so that the buffered data warning is not displayed.
1651
+ */
1652
+ if (php_stream_can_cast (stream , PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL ) == SUCCESS ) {
1653
+ php_stream_cast (stream , PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL , (void * )& fileno , 0 );
1654
+ } else if (php_stream_can_cast (stream , PHP_STREAM_AS_FD | PHP_STREAM_CAST_INTERNAL ) == SUCCESS ) {
1655
+ php_stream_cast (stream , PHP_STREAM_AS_FD | PHP_STREAM_CAST_INTERNAL , (void * )& fileno , 0 );
1652
1656
} else {
1653
1657
RETURN_FALSE ;
1654
1658
}
@@ -1686,13 +1690,15 @@ PHP_FUNCTION(sapi_windows_vt100_support)
1686
1690
1687
1691
php_stream_from_zval (stream , zsrc );
1688
1692
1689
- if (php_stream_can_cast (stream , PHP_STREAM_AS_FD_FOR_SELECT ) == SUCCESS ) {
1690
- php_stream_cast (stream , PHP_STREAM_AS_FD_FOR_SELECT , (void * )& fileno , 0 );
1691
- }
1692
- else if (php_stream_can_cast (stream , PHP_STREAM_AS_FD ) == SUCCESS ) {
1693
- php_stream_cast (stream , PHP_STREAM_AS_FD , (void * )& fileno , 0 );
1694
- }
1695
- else {
1693
+ /* get the fd.
1694
+ * NB: Most other code will NOT use the PHP_STREAM_CAST_INTERNAL flag when casting.
1695
+ * It is only used here so that the buffered data warning is not displayed.
1696
+ */
1697
+ if (php_stream_can_cast (stream , PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL ) == SUCCESS ) {
1698
+ php_stream_cast (stream , PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL , (void * )& fileno , 0 );
1699
+ } else if (php_stream_can_cast (stream , PHP_STREAM_AS_FD | PHP_STREAM_CAST_INTERNAL ) == SUCCESS ) {
1700
+ php_stream_cast (stream , PHP_STREAM_AS_FD | PHP_STREAM_CAST_INTERNAL , (void * )& fileno , 0 );
1701
+ } else {
1696
1702
if (!enable_is_null ) {
1697
1703
php_error_docref (
1698
1704
NULL ,
0 commit comments