Skip to content

getaddrinfo conversion #15555

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -599,8 +599,6 @@ dnl Check for functions inside their belonging headers.
AC_CHECK_HEADER([sys/prctl.h], [AC_CHECK_FUNCS([prctl])])
AC_CHECK_HEADER([sys/procctl.h], [AC_CHECK_FUNCS([procctl])])

AX_FUNC_WHICH_GETHOSTBYNAME_R

dnl Some systems (Solaris 10) do not have nanosleep in libc.
AC_CHECK_FUNCS([nanosleep],,
[AC_SEARCH_LIBS([nanosleep], [rt], [AC_DEFINE([HAVE_NANOSLEEP], [1])])])
Expand Down
2 changes: 1 addition & 1 deletion ext/curl/tests/curl_basic_008.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ curl
--SKIPIF--
<?php
$addr = "www.".uniqid().".invalid";
if (gethostbyname($addr) != $addr) {
if (@gethostbyname($addr) != $addr) {
print "skip catch all dns";
}
?>
Expand Down
2 changes: 1 addition & 1 deletion ext/curl/tests/curl_basic_010.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ curl
--SKIPIF--
<?php
$addr = "www.".uniqid().".".uniqid();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surely we could try to come up with something that we know does not exist? Like a weird subdomain name of php.net

if (gethostbyname($addr) != $addr) {
if (@gethostbyname($addr) != $addr) {
print "skip catch all dns";
}
?>
Expand Down
5 changes: 0 additions & 5 deletions ext/standard/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,6 @@ static void file_globals_ctor(php_file_globals *file_globals_p)

static void file_globals_dtor(php_file_globals *file_globals_p)
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Call to this should also be removed then.

#if defined(HAVE_GETHOSTBYNAME_R)
if (file_globals_p->tmp_host_buf) {
free(file_globals_p->tmp_host_buf);
}
#endif
}

static PHP_INI_MH(OnUpdateAutoDetectLineEndings)
Expand Down
5 changes: 0 additions & 5 deletions ext/standard/file.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,6 @@ typedef struct {
HashTable *stream_filters; /* per-request copy of stream_filters_hash */
HashTable *wrapper_errors; /* key: wrapper address; value: linked list of char* */
int pclose_wait;
#ifdef HAVE_GETHOSTBYNAME_R
struct hostent tmp_host_info;
char *tmp_host_buf;
size_t tmp_host_buf_len;
#endif
} php_file_globals;

#ifdef ZTS
Expand Down
2 changes: 1 addition & 1 deletion ext/standard/tests/network/gethostbyname_error003.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ gethostbyname() function - basic type return error test
var_dump(is_string(gethostbyname("asdfasdf")));
?>
--EXPECTF--
Warning: gethostbyname(): php_network_getaddresses: getaddrinfo for asdfasdf failed: nodename nor servname provided, or not known in %s on line %d
Warning: gethostbyname(): php_network_getaddresses: getaddrinfo for asdfasdf failed: %s in %s on line %d
bool(true)
2 changes: 1 addition & 1 deletion ext/standard/tests/network/gethostbyname_error006.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ gethostbyname() function - basic invalid parameter test
var_dump(gethostbyname(".toto.toto.toto"));
?>
--EXPECTF--
Warning: gethostbyname(): php_network_getaddresses: getaddrinfo for .toto.toto.toto failed: nodename nor servname provided, or not known in %s on line %d
Warning: gethostbyname(): php_network_getaddresses: getaddrinfo for .toto.toto.toto failed: %s in %s on line %d
string(15) ".toto.toto.toto"
2 changes: 1 addition & 1 deletion main/php_network.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ END_EXTERN_C()
#include <sys/socket.h>
#endif

#ifdef HAVE_GETHOSTBYNAME_R
#ifndef PHP_WIN32
#include <netdb.h>
#endif

Expand Down
Loading