mirror of
https://github.com/php/php-src.git
synced 2024-11-30 21:35:36 +08:00
Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0: Bugfix #74556 stream_socket_get_name() returns empty string Fix abstract name handling to be binary safe
This commit is contained in:
commit
e628ee9e9d
4
NEWS
4
NEWS
@ -5,6 +5,7 @@ PHP NEWS
|
||||
- Core:
|
||||
. Fixed bug #74658 (Undefined constants in array properties result in broken
|
||||
properties). (Laruence)
|
||||
. Fixed misparsing of abstract unix domain socket names. (Sara)
|
||||
|
||||
- Opcache:
|
||||
. Fixed bug #74663 (Segfault with opcache.memory_protect and
|
||||
@ -17,6 +18,9 @@ PHP NEWS
|
||||
- FTP:
|
||||
. Fixed bug #74598 (ftp:// wrapper ignores context arg). (Sara)
|
||||
|
||||
- Streams:
|
||||
. Fixed bug #74556 (stream_socket_get_name() returns '\0'). (Sara)
|
||||
|
||||
8 Jun 2017, PHP 7.1.6
|
||||
|
||||
- Core:
|
||||
|
@ -314,6 +314,11 @@ PHP_FUNCTION(stream_socket_get_name)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (!ZSTR_LEN(name)) {
|
||||
zend_string_release(name);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
RETVAL_STR(name);
|
||||
}
|
||||
/* }}} */
|
||||
|
22
ext/standard/tests/streams/bug74556.phpt
Normal file
22
ext/standard/tests/streams/bug74556.phpt
Normal file
@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
Bug #74556 stream_socket_get_name() on unix socket returns "\0"
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!strncasecmp(PHP_OS, 'WIN', 3)) echo "skip Unix Only";
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$sock = __DIR__ . '/bug74556.sock';
|
||||
$s = stream_socket_server("unix://$sock");
|
||||
$c = stream_socket_client("unix://$sock");
|
||||
|
||||
var_dump(
|
||||
stream_socket_get_name($s, true),
|
||||
stream_socket_get_name($c, false)
|
||||
);
|
||||
--CLEAN--
|
||||
<?php
|
||||
unlink(__DIR__ . '/bug74556.sock');
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
bool(false)
|
@ -661,7 +661,7 @@ PHPAPI void php_network_populate_name_from_sockaddr(
|
||||
|
||||
if (ua->sun_path[0] == '\0') {
|
||||
/* abstract name */
|
||||
int len = strlen(ua->sun_path + 1) + 1;
|
||||
int len = sl - sizeof(sa_family_t);
|
||||
*textaddr = zend_string_init((char*)ua->sun_path, len, 0);
|
||||
} else {
|
||||
int len = strlen(ua->sun_path);
|
||||
|
Loading…
Reference in New Issue
Block a user