File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,8 @@ PHP NEWS
43
43
- Standard:
44
44
. Fixed the crypt_sha256/512 api build with clang > 12. (David Carlier)
45
45
. Uses CCRandomGenerateBytes instead of arc4random_buf on macOs. (David Carlier).
46
+ . Fixed bug GH-9017 (php_stream_sock_open_from_socket could return NULL).
47
+ (Heiko Weber)
46
48
47
49
07 Jul 2022, PHP 8.1.8
48
50
Original file line number Diff line number Diff line change @@ -67,10 +67,22 @@ PHP_FUNCTION(stream_socket_pair)
67
67
RETURN_FALSE ;
68
68
}
69
69
70
- array_init (return_value );
71
-
72
- s1 = php_stream_sock_open_from_socket (pair [0 ], 0 );
73
- s2 = php_stream_sock_open_from_socket (pair [1 ], 0 );
70
+ s1 = php_stream_sock_open_from_socket (pair [0 ], 0 );
71
+ if (s1 == NULL ) {
72
+ close (pair [0 ]);
73
+ close (pair [1 ]);
74
+ php_error_docref (NULL , E_WARNING , "Failed to open stream from socketpair" );
75
+ RETURN_FALSE ;
76
+ }
77
+ s2 = php_stream_sock_open_from_socket (pair [1 ], 0 );
78
+ if (s2 == NULL ) {
79
+ php_stream_free (s1 , PHP_STREAM_FREE_CLOSE );
80
+ close (pair [1 ]);
81
+ php_error_docref (NULL , E_WARNING , "Failed to open stream from socketpair" );
82
+ RETURN_FALSE ;
83
+ }
84
+
85
+ array_init (return_value );
74
86
75
87
/* set the __exposed flag.
76
88
* php_stream_to_zval() does, add_next_index_resource() does not */
You can’t perform that action at this time.
0 commit comments