return -1;
}
- && zend_is_true(*tmpzval)
+ #ifdef SO_REUSEPORT
+ if (stream->context
+ && php_stream_context_get_option(stream->context, "socket", "so_reuseport", &tmpzval) == SUCCESS
- && zend_is_true(*tmpzval)
++ && zend_is_true(*tmpzval TSRMLS_CC)
+ ) {
+ sockopts |= STREAM_SOCKOP_SO_REUSEPORT;
+ }
+ #endif
+
+ #ifdef SO_BROADCAST
+ if (&php_stream_udp_socket_ops /* SO_BROADCAST is only applicable for UDP */
+ && stream->context
+ && php_stream_context_get_option(stream->context, "socket", "so_broadcast", &tmpzval) == SUCCESS
++ && zend_is_true(*tmpzval TSRMLS_CC)
+ ) {
+ sockopts |= STREAM_SOCKOP_SO_BROADCAST;
+ }
+ #endif
+
sock->socket = php_network_bind_socket_to_local_addr(host, portno,
stream->ops == &php_stream_udp_socket_ops ? SOCK_DGRAM : SOCK_STREAM,
+ sockopts,
xparam->want_errortext ? &xparam->outputs.error_text : NULL,
&err
TSRMLS_CC);
bindto = parse_ip_address_ex(Z_STRVAL_PP(tmpzval), Z_STRLEN_PP(tmpzval), &bindport, xparam->want_errortext, &xparam->outputs.error_text TSRMLS_CC);
}
- && zend_is_true(*tmpzval)
+ #ifdef SO_BROADCAST
+ if (&php_stream_udp_socket_ops /* SO_BROADCAST is only applicable for UDP */
+ && stream->context
+ && php_stream_context_get_option(stream->context, "socket", "so_broadcast", &tmpzval) == SUCCESS
++ && zend_is_true(*tmpzval TSRMLS_CC)
+ ) {
+ sockopts |= STREAM_SOCKOP_SO_BROADCAST;
+ }
+ #endif
+
/* Note: the test here for php_stream_udp_socket_ops is important, because we
* want the default to be TCP sockets so that the openssl extension can
* re-use this code. */