File tree 3 files changed +25
-4
lines changed
3 files changed +25
-4
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,9 @@ PHP NEWS
57
57
- SPL:
58
58
. Fixed bug GH-10519 (Array Data Address Reference Issue). (Nathan Freeman)
59
59
60
+ - Standard:
61
+ . Fixed bug GH-10885 (stream_socket_server context leaks). (ilutov)
62
+
60
63
16 Mar 2023, PHP 8.2.4
61
64
62
65
- Core:
Original file line number Diff line number Diff line change @@ -213,10 +213,6 @@ PHP_FUNCTION(stream_socket_server)
213
213
214
214
context = php_stream_context_from_zval (zcontext , flags & PHP_FILE_NO_DEFAULT_CONTEXT );
215
215
216
- if (context ) {
217
- GC_ADDREF (context -> res );
218
- }
219
-
220
216
if (zerrno ) {
221
217
ZEND_TRY_ASSIGN_REF_LONG (zerrno , 0 );
222
218
}
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ GH-10885: stream_socket_server context leaks
3
+ --FILE--
4
+ <?php
5
+ $ context = stream_context_create ();
6
+ debug_zval_dump ($ context );
7
+ $ server = @\stream_socket_server (
8
+ 'tcp://127.0.0.1:0 ' ,
9
+ $ errno ,
10
+ $ errstr ,
11
+ \STREAM_SERVER_BIND | \STREAM_SERVER_LISTEN ,
12
+ $ context ,
13
+ );
14
+ debug_zval_dump ($ context );
15
+ fclose ($ server );
16
+ unset($ server );
17
+ debug_zval_dump ($ context );
18
+ ?>
19
+ --EXPECTF--
20
+ resource(%d) of type (stream-context) refcount(2)
21
+ resource(%d) of type (stream-context) refcount(3)
22
+ resource(%d) of type (stream-context) refcount(2)
You can’t perform that action at this time.
0 commit comments