Merge branch 'PHP-5.5' into PHP-5.6

* PHP-5.5:
  Fix bug #64330
This commit is contained in:
Michael Wallner 2014-04-02 11:11:23 +02:00
commit 669459da8c
2 changed files with 22 additions and 1 deletions

View File

@ -0,0 +1,20 @@
--TEST--
Bug #64330 (stream_socket_server() creates wrong Abstract Namespace UNIX sockets)
--SKIPIF--
<?php
if (!in_array("unix", stream_get_transports())) die("SKIP unix domain sockets unavailable");
?>
--FILE--
<?php
echo "Test\n";
$server = stream_socket_server("unix://\x00/MyBindName");
$client = stream_socket_client("unix://\x00/MyBindName");
if ($client) {
echo "ok\n";
}
?>
===DONE===
--EXPECT--
Test
ok
===DONE===

View File

@ -588,7 +588,8 @@ static inline int php_tcp_sockop_bind(php_stream *stream, php_netstream_data_t *
parse_unix_address(xparam, &unix_addr TSRMLS_CC);
return bind(sock->socket, (struct sockaddr *)&unix_addr, sizeof(unix_addr));
return bind(sock->socket, (const struct sockaddr *)&unix_addr,
(socklen_t) XtOffsetOf(struct sockaddr_un, sun_path) + xparam->inputs.namelen);
}
#endif