diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 78ce124d662..33ca9b7e1c1 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -5582,6 +5582,15 @@ PHP_FUNCTION(getservbyname) return; } + +/* empty string behaves like NULL on windows implementation of + getservbyname. Let be portable instead. */ +#ifdef PHP_WIN32 + if (proto_len == 0) { + RETURN_FALSE; + } +#endif + serv = getservbyname(name, proto); if (serv == NULL) {