@@ -2252,7 +2252,6 @@ PHP_FUNCTION(socket_export_stream)
2252
2252
php_stream * stream = NULL ;
2253
2253
php_netstream_data_t * stream_data ;
2254
2254
char * protocol = NULL ;
2255
- size_t protocollen = 0 ;
2256
2255
2257
2256
if (zend_parse_parameters (ZEND_NUM_ARGS (), "O" , & zsocket , socket_ce ) == FAILURE ) {
2258
2257
RETURN_THROWS ();
@@ -2287,12 +2286,10 @@ PHP_FUNCTION(socket_export_stream)
2287
2286
if (protoid == IPPROTO_TCP )
2288
2287
#endif
2289
2288
{
2290
- protocol = "tcp" ;
2291
- protocollen = 3 ;
2289
+ protocol = "tcp://" ;
2292
2290
}
2293
2291
} else if (protoid == SOCK_DGRAM ) {
2294
- protocol = "udp" ;
2295
- protocollen = 3 ;
2292
+ protocol = "udp://" ;
2296
2293
}
2297
2294
#ifdef PF_UNIX
2298
2295
} else if (socket -> type == PF_UNIX ) {
@@ -2302,11 +2299,9 @@ PHP_FUNCTION(socket_export_stream)
2302
2299
getsockopt (socket -> bsd_socket , SOL_SOCKET , SO_TYPE , (char * ) & type , & typelen );
2303
2300
2304
2301
if (type == SOCK_STREAM ) {
2305
- protocol = "unix" ;
2306
- protocollen = 4 ;
2302
+ protocol = "unix://" ;
2307
2303
} else if (type == SOCK_DGRAM ) {
2308
- protocol = "udg" ;
2309
- protocollen = 3 ;
2304
+ protocol = "udg://" ;
2310
2305
}
2311
2306
#endif
2312
2307
}
@@ -2315,7 +2310,7 @@ PHP_FUNCTION(socket_export_stream)
2315
2310
* We don't want streams to actually *do* anything though, so don't give it
2316
2311
* anything apart from the protocol */
2317
2312
if (protocol != NULL ) {
2318
- stream = php_stream_xport_create (protocol , protocollen , 0 , 0 , NULL , NULL , NULL , NULL , NULL );
2313
+ stream = php_stream_xport_create (protocol , strlen ( protocol ) , 0 , 0 , NULL , NULL , NULL , NULL , NULL );
2319
2314
}
2320
2315
2321
2316
/* Fall back to creating a generic socket stream */
0 commit comments