Skip to content

Commit ccb09d2

Browse files
Merge branch 'PHP-7.1' into PHP-7.2
2 parents e8f552a + 158b06c commit ccb09d2

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ PHP NEWS
1212
. Fixed bug #75089 (preg_grep() is not reporting PREG_BAD_UTF8_ERROR after
1313
first input string). (Dmitry)
1414

15+
- Standard:
16+
. Fixed bug #75097 (gethostname fails if your host name is 64 chars long). (Andrea)
17+
1518
17 Aug 2017, PHP 7.2.0beta3
1619

1720
- Core:

ext/standard/dns.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,13 @@ static zend_string *php_gethostbyname(char *name);
126126
Get the host name of the current machine */
127127
PHP_FUNCTION(gethostname)
128128
{
129-
char buf[HOST_NAME_MAX];
129+
char buf[HOST_NAME_MAX + 1];
130130

131131
if (zend_parse_parameters_none() == FAILURE) {
132132
return;
133133
}
134134

135-
if (gethostname(buf, sizeof(buf) - 1)) {
135+
if (gethostname(buf, sizeof(buf))) {
136136
php_error_docref(NULL, E_WARNING, "unable to fetch host [%d]: %s", errno, strerror(errno));
137137
RETURN_FALSE;
138138
}

0 commit comments

Comments
 (0)