]> granicus.if.org Git - php/commitdiff
Fixed #72974 imap is undefined service on AIX
authorJoe Watkins <krakjoe@php.net>
Mon, 9 Jan 2017 05:13:46 +0000 (05:13 +0000)
committerJoe Watkins <krakjoe@php.net>
Mon, 9 Jan 2017 05:15:21 +0000 (05:15 +0000)
NEWS
ext/standard/basic_functions.c

diff --git a/NEWS b/NEWS
index 005ad09d87783b3dfaeeb087fc2b87014eaf148f..224ed83fae37e632e226e8872e635f99539f07f0 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -26,6 +26,7 @@ PHP                                                                        NEWS
   . Fixed bug #69442 (closing of fd incorrect when PTS enabled). (jaytaph)
   . Fixed bug #47021 (SoapClient stumbles over WSDL delivered with
     "Transfer-Encoding: chunked"). (Rowan Collins)
+  . Fixed bug #72974 (imap is undefined service on AIX). (matthieu.sarter)
 
 - ZIP:
   . Fixed bug #70103 (ZipArchive::addGlob ignores remove_all_path option). (cmb,
index 132d34099064c052406b6deeefa10af514bcc041..eeb3031ccc22a2b0f3058e12983c214e6a320bc8 100644 (file)
@@ -5551,6 +5551,15 @@ PHP_FUNCTION(getservbyname)
 
        serv = getservbyname(name, proto);
 
+#if defined(_AIX)
+       /*
+        On AIX, imap is only known as imap2 in /etc/services, while on Linux imap is an alias for imap2.
+        If a request for imap gives no result, we try again with imap2.
+        */
+       if (serv == NULL && strcmp(name,  "imap") == 0) {
+               serv = getservbyname("imap2", proto);
+       }
+#endif
        if (serv == NULL) {
                RETURN_FALSE;
        }