Skip to content

Commit 13fbc40

Browse files
committed
Keep the orig_path for xport stream
1 parent b06a6b8 commit 13fbc40

7 files changed

+48
-20
lines changed

ext/standard/tests/streams/stream_get_meta_data_socket_basic.phpt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ fclose($tcp_socket);
99

1010
?>
1111
--EXPECTF--
12-
array(7) {
12+
array(8) {
1313
["timed_out"]=>
1414
bool(false)
1515
["blocked"]=>
@@ -24,4 +24,6 @@ array(7) {
2424
int(0)
2525
["seekable"]=>
2626
bool(false)
27+
["uri"]=>
28+
string(21) "tcp://127.0.0.1:31330"
2729
}

ext/standard/tests/streams/stream_get_meta_data_socket_variation1.phpt

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ var_dump(stream_get_meta_data($client));
3838
?>
3939
--EXPECTF--
4040
Write some data:
41-
array(7) {
41+
array(8) {
4242
["timed_out"]=>
4343
bool(false)
4444
["blocked"]=>
@@ -53,11 +53,13 @@ array(7) {
5353
int(0)
5454
["seekable"]=>
5555
bool(false)
56+
["uri"]=>
57+
string(21) "tcp://127.0.0.1:31331"
5658
}
5759

5860

5961
Read a line from the client, causing data to be buffered:
60-
array(7) {
62+
array(8) {
6163
["timed_out"]=>
6264
bool(false)
6365
["blocked"]=>
@@ -72,11 +74,13 @@ array(7) {
7274
int(15)
7375
["seekable"]=>
7476
bool(false)
77+
["uri"]=>
78+
string(21) "tcp://127.0.0.1:31331"
7579
}
7680

7781

7882
Read 3 bytes of data from the client:
79-
array(7) {
83+
array(8) {
8084
["timed_out"]=>
8185
bool(false)
8286
["blocked"]=>
@@ -91,11 +95,13 @@ array(7) {
9195
int(12)
9296
["seekable"]=>
9397
bool(false)
98+
["uri"]=>
99+
string(21) "tcp://127.0.0.1:31331"
94100
}
95101

96102

97103
Close the server side socket and read the remaining data from the client:
98-
array(7) {
104+
array(8) {
99105
["timed_out"]=>
100106
bool(false)
101107
["blocked"]=>
@@ -110,4 +116,6 @@ array(7) {
110116
int(0)
111117
["seekable"]=>
112118
bool(false)
119+
["uri"]=>
120+
string(21) "tcp://127.0.0.1:31331"
113121
}

ext/standard/tests/streams/stream_get_meta_data_socket_variation2.phpt

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fclose($server);
3636

3737
?>
3838
--EXPECTF--
39-
array(7) {
39+
array(8) {
4040
["timed_out"]=>
4141
bool(false)
4242
["blocked"]=>
@@ -51,11 +51,13 @@ array(7) {
5151
int(0)
5252
["seekable"]=>
5353
bool(false)
54+
["uri"]=>
55+
string(21) "tcp://127.0.0.1:31332"
5456
}
5557

5658

5759
Set a timeout on the client and attempt a read:
58-
array(7) {
60+
array(8) {
5961
["timed_out"]=>
6062
bool(true)
6163
["blocked"]=>
@@ -70,11 +72,13 @@ array(7) {
7072
int(0)
7173
["seekable"]=>
7274
bool(false)
75+
["uri"]=>
76+
string(21) "tcp://127.0.0.1:31332"
7377
}
7478

7579

7680
Write some data from the server:
77-
array(7) {
81+
array(8) {
7882
["timed_out"]=>
7983
bool(true)
8084
["blocked"]=>
@@ -89,11 +93,13 @@ array(7) {
8993
int(0)
9094
["seekable"]=>
9195
bool(false)
96+
["uri"]=>
97+
string(21) "tcp://127.0.0.1:31332"
9298
}
9399

94100

95101
Read some data from the client:
96-
array(7) {
102+
array(8) {
97103
["timed_out"]=>
98104
bool(false)
99105
["blocked"]=>
@@ -108,4 +114,6 @@ array(7) {
108114
int(0)
109115
["seekable"]=>
110116
bool(false)
117+
["uri"]=>
118+
string(21) "tcp://127.0.0.1:31332"
111119
}

ext/standard/tests/streams/stream_get_meta_data_socket_variation3.phpt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ fclose($server);
3131

3232
?>
3333
--EXPECTF--
34-
array(7) {
34+
array(8) {
3535
["timed_out"]=>
3636
bool(false)
3737
["blocked"]=>
@@ -46,12 +46,14 @@ array(7) {
4646
int(0)
4747
["seekable"]=>
4848
bool(false)
49+
["uri"]=>
50+
string(21) "tcp://127.0.0.1:31333"
4951
}
5052

5153

5254
Set blocking to false:
5355
bool(true)
54-
array(7) {
56+
array(8) {
5557
["timed_out"]=>
5658
bool(false)
5759
["blocked"]=>
@@ -66,12 +68,14 @@ array(7) {
6668
int(0)
6769
["seekable"]=>
6870
bool(false)
71+
["uri"]=>
72+
string(21) "tcp://127.0.0.1:31333"
6973
}
7074

7175

7276
Set blocking to true:
7377
bool(true)
74-
array(7) {
78+
array(8) {
7579
["timed_out"]=>
7680
bool(false)
7781
["blocked"]=>
@@ -86,4 +90,6 @@ array(7) {
8690
int(0)
8791
["seekable"]=>
8892
bool(false)
93+
["uri"]=>
94+
string(21) "tcp://127.0.0.1:31333"
8995
}

ext/standard/tests/streams/stream_get_meta_data_socket_variation4.phpt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fclose($client);
3636
?>
3737
--EXPECTF--
3838
Write some data:
39-
array(7) {
39+
array(8) {
4040
["timed_out"]=>
4141
bool(false)
4242
["blocked"]=>
@@ -51,11 +51,13 @@ array(7) {
5151
int(%i)
5252
["seekable"]=>
5353
bool(false)
54+
["uri"]=>
55+
string(21) "tcp://127.0.0.1:31334"
5456
}
5557

5658

5759
Read a line from the client:
58-
array(7) {
60+
array(8) {
5961
["timed_out"]=>
6062
bool(false)
6163
["blocked"]=>
@@ -70,11 +72,13 @@ array(7) {
7072
int(%i)
7173
["seekable"]=>
7274
bool(false)
75+
["uri"]=>
76+
string(21) "tcp://127.0.0.1:31334"
7377
}
7478

7579

7680
Close the server side socket and read the remaining data from the client:
77-
array(7) {
81+
array(8) {
7882
["timed_out"]=>
7983
bool(false)
8084
["blocked"]=>
@@ -89,4 +93,6 @@ array(7) {
8993
int(%i)
9094
["seekable"]=>
9195
bool(false)
96+
["uri"]=>
97+
string(21) "tcp://127.0.0.1:31334"
9298
}

main/streams/transports.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ PHPAPI php_stream *_php_stream_xport_create(const char *name, size_t namelen, in
5959
{
6060
php_stream *stream = NULL;
6161
php_stream_transport_factory factory = NULL;
62-
const char *p, *protocol = NULL;
62+
const char *p, *protocol, *orig_path = NULL;
6363
size_t n = 0;
6464
bool failed = false;
6565
bool bailout = false;
@@ -94,6 +94,7 @@ PHPAPI php_stream *_php_stream_xport_create(const char *name, size_t namelen, in
9494
}
9595
}
9696

97+
orig_path = name;
9798
for (p = name; isalnum((int)*p) || *p == '+' || *p == '-' || *p == '.'; p++) {
9899
n++;
99100
}
@@ -135,6 +136,7 @@ PHPAPI php_stream *_php_stream_xport_create(const char *name, size_t namelen, in
135136
if (stream) {
136137
zend_try {
137138
php_stream_context_set(stream, context);
139+
stream->orig_path = pestrdup(orig_path, persistent_id ? 1 : 0);
138140

139141
if ((flags & STREAM_XPORT_SERVER) == 0) {
140142
/* client */

main/streams/xp_socket.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -966,9 +966,5 @@ PHPAPI php_stream *php_stream_generic_socket_factory(const char *proto, size_t p
966966
return NULL;
967967
}
968968

969-
if (flags == 0) {
970-
return stream;
971-
}
972-
973969
return stream;
974970
}

0 commit comments

Comments
 (0)