php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #76138
Patch 0001-HP-UX-PHP-specific-changes revision 2018-04-11 10:42 UTC by ashishj at hpe dot com
revision 2018-04-11 10:42 UTC by ashishj at hpe dot com

Patch 0001-HP-UX-PHP-specific-changes for *Compile Issues Bug #76138

Patch version 2018-04-11 10:42 UTC

Return to Bug #76138 | Download this patch
Patch Revisions:

Developer: ashishj@hpe.com

From 0313c87bfc09ae26da7b9f04fb22f8552d6c0cbe Mon Sep 17 00:00:00 2001
From: Ashish Jaiswal <ashishj@hpe.com>
Date: Tue, 10 Apr 2018 17:27:29 +0530
Subject: [PATCH]  HP-UX PHP specific changes

---
 config.sub                          |  4 +-
 ext/ftp/ftp.c                       | 36 +++++++++++++++--
 ext/sockets/sockets.c               | 77 ++++++++++++++++++++++++++++++++-----
 ext/standard/random.c               |  5 +++
 main/network.c                      | 65 +++++++++++++++++++++++++++++++
 main/php_network.h                  | 38 +++++++++++++++++-
 sapi/apache2handler/php_functions.c |  5 +++
 sapi/phpdbg/phpdbg_out.h            | 12 ++++++
 8 files changed, 225 insertions(+), 17 deletions(-)

diff --git a/config.sub b/config.sub
index e8b950c..77e406b 100644
--- a/config.sub
+++ b/config.sub
@@ -261,7 +261,7 @@ case $basic_machine in
 	| d10v | d30v | dlx | dsp16xx \
 	| epiphany \
 	| fido | fr30 | frv \
-	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0 | hppa64 \
+	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
 	| hexagon \
 	| i370 | i860 | i960 | ia64 \
 	| ip2k | iq2000 \
@@ -384,7 +384,7 @@ case $basic_machine in
 	| elxsi-* \
 	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
 	| h8300-* | h8500-* \
-	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0-* | hppa64-* \
+	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
 	| hexagon-* \
 	| i*86-* | i860-* | i960-* | ia64-* \
 	| ip2k-* | iq2000-* \
diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c
index 6d03f86..270b89a 100644
--- a/ext/ftp/ftp.c
+++ b/ext/ftp/ftp.c
@@ -77,7 +77,13 @@ static int		ftp_putcmd(	ftpbuf_t *ftp,
 /* wrapper around send/recv to handle timeouts */
 static int		my_send(ftpbuf_t *ftp, php_socket_t s, void *buf, size_t len);
 static int		my_recv(ftpbuf_t *ftp, php_socket_t s, void *buf, size_t len);
+
+#if defined (__hpux)
+/* On HP-UX, socket APIs expect "integer" as data type for length of the "option" data structure. */
+static int		my_accept(ftpbuf_t *ftp, php_socket_t s, struct sockaddr *addr, int *addrlen);
+#else
 static int		my_accept(ftpbuf_t *ftp, php_socket_t s, struct sockaddr *addr, socklen_t *addrlen);
+#endif
 
 /* reads a line the socket , returns true on success, false on error */
 static int		ftp_readline(ftpbuf_t *ftp);
@@ -113,7 +119,12 @@ ftpbuf_t*
 ftp_open(const char *host, short port, zend_long timeout_sec)
 {
 	ftpbuf_t		*ftp;
+#if defined (__hpux)
+/* On HP-UX, socket APIs expect "integer" as data type for length of the "option" data structure. */
+	int 			 size;
+#else
 	socklen_t		 size;
+#endif
 	struct timeval tv;
 
 
@@ -792,7 +803,12 @@ ftp_pasv(ftpbuf_t *ftp, int pasv)
 	char			*ptr;
 	union ipbox		ipbox;
 	unsigned long		b[6];
-	socklen_t			n;
+#if defined (__hpux)
+/* On HP-UX, socket APIs expect "integer" as data type for length of the "option" data structure. */
+	int 			n;
+#else
+	socklen_t		n;
+#endif
 	struct sockaddr *sa;
 	struct sockaddr_in *sin;
 
@@ -1615,7 +1631,12 @@ data_writeable(ftpbuf_t *ftp, php_socket_t s)
 /* {{{ my_accept
  */
 int
+#if defined (__hpux)
+/* On HP-UX, socket APIs expect "integer" as data type for length of the "option" data structure. */
+my_accept(ftpbuf_t *ftp, php_socket_t s, struct sockaddr *addr, int *addrlen)
+#else
 my_accept(ftpbuf_t *ftp, php_socket_t s, struct sockaddr *addr, socklen_t *addrlen)
+#endif
 {
 	int		n;
 
@@ -1646,7 +1667,12 @@ ftp_getdata(ftpbuf_t *ftp)
 	databuf_t		*data;
 	php_sockaddr_storage addr;
 	struct sockaddr *sa;
+#if defined (__hpux)
+/* On HP-UX, socket APIs expect "integer" as data type for length of the "option" data structure. */
+	int			size;
+#else
 	socklen_t		size;
+#endif
 	union ipbox		ipbox;
 	char			arg[sizeof("255, 255, 255, 255, 255, 255")];
 	struct timeval	tv;
@@ -1774,8 +1800,12 @@ databuf_t*
 data_accept(databuf_t *data, ftpbuf_t *ftp)
 {
 	php_sockaddr_storage addr;
-	socklen_t			size;
-
+#if defined (__hpux)
+/* On HP-UX, socket APIs expect "integer" as data type for length of the "option" data structure. */
+        int                     size;
+#else
+        socklen_t               size;
+#endif
 #ifdef HAVE_FTP_SSL
 	SSL_CTX		*ctx;
 	SSL_SESSION *session;
diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c
index c3f1f92..7dc851d 100644
--- a/ext/sockets/sockets.c
+++ b/ext/sockets/sockets.c
@@ -512,8 +512,12 @@ static int php_open_listen_sock(php_socket **php_sock, int port, int backlog) /*
 	return 1;
 }
 /* }}} */
-
+#if defined (__hpux)
+/* On HP-UX, socket APIs expect "integer" as data type for length of the "option" data structure. */
+static int php_accept_connect(php_socket *in_sock, php_socket **new_sock, struct sockaddr *la, int *la_len) /* {{{ */
+#else
 static int php_accept_connect(php_socket *in_sock, php_socket **new_sock, struct sockaddr *la, socklen_t *la_len) /* {{{ */
+#endif
 {
 	php_socket	*out_sock = php_create_socket();
 
@@ -1010,7 +1014,12 @@ PHP_FUNCTION(socket_accept)
 	zval				 *arg1;
 	php_socket			 *php_sock, *new_sock;
 	php_sockaddr_storage sa;
-	socklen_t			 php_sa_len = sizeof(sa);
+#if defined (__hpux)
+/* On HP-UX, socket APIs expect "integer" as data type for length of the "option" data structure. */
+	int				 php_sa_len = sizeof(sa);
+#else
+	socklen_t                        php_sa_len = sizeof(sa);
+#endif
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &arg1) == FAILURE) {
 		return;
@@ -1273,7 +1282,12 @@ PHP_FUNCTION(socket_getsockname)
 #endif
 	struct sockaddr_un		*s_un;
 	char					*addr_string;
-	socklen_t				salen = sizeof(php_sockaddr_storage);
+#if defined (__hpux)
+/* On HP-UX, socket APIs expect "integer" as data type for length of the "option" data structure. */
+	int				salen = sizeof(php_sockaddr_storage);
+#else
+	socklen_t                               salen = sizeof(php_sockaddr_storage);
+#endif
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS(), "rz/|z/", &arg1, &addr, &port) == FAILURE) {
 		return;
@@ -1356,7 +1370,12 @@ PHP_FUNCTION(socket_getpeername)
 #endif
 	struct sockaddr_un		*s_un;
 	char					*addr_string;
-	socklen_t				salen = sizeof(php_sockaddr_storage);
+#if defined (__hpux)
+/* On HP-UX, socket APIs expect "integer" as data type for length of the "option" data structure. */
+	int					salen = sizeof(php_sockaddr_storage);
+#else
+	socklen_t                               salen = sizeof(php_sockaddr_storage);
+#endif
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS(), "rz/|z/", &arg1, &arg2, &arg3) == FAILURE) {
 		return;
@@ -1537,8 +1556,14 @@ PHP_FUNCTION(socket_connect)
 
 			s_un.sun_family = AF_UNIX;
 			memcpy(&s_un.sun_path, addr, addr_len);
+#if defined (__hpux)
+/* On HP-UX, socket APIs expect "integer" as data type for length of the "option" data structure. */
+			retval = connect(php_sock->bsd_socket, (struct sockaddr *) &s_un,
+				(int)(XtOffsetOf(struct sockaddr_un, sun_path) + addr_len));
+#else
 			retval = connect(php_sock->bsd_socket, (struct sockaddr *) &s_un,
-				(socklen_t)(XtOffsetOf(struct sockaddr_un, sun_path) + addr_len));
+				 (socklen_t)(XtOffsetOf(struct sockaddr_un, sun_path) + addr_len));
+#endif
 			break;
 		}
 
@@ -1744,7 +1769,12 @@ PHP_FUNCTION(socket_recvfrom)
 	struct sockaddr_in6	sin6;
 	char				addr6[INET6_ADDRSTRLEN];
 #endif
+#if defined (__hpux)
+/* On HP-UX, socket APIs expect "integer" as data type for length of the "option" data structure. */
+	int				slen;
+#else
 	socklen_t			slen;
+#endif
 	int					retval;
 	zend_long				arg3, arg4;
 	char				*address;
@@ -1769,7 +1799,12 @@ PHP_FUNCTION(socket_recvfrom)
 		case AF_UNIX:
 			slen = sizeof(s_un);
 			s_un.sun_family = AF_UNIX;
+#if defined (__hpux)
+/* On HP-UX, socket APIs expect "integer" as data type for length of the "option" data structure. */
+			retval = recvfrom(php_sock->bsd_socket, ZSTR_VAL(recv_buf), arg3, arg4, (struct sockaddr *)&s_un, (int *)&slen);
+#else
 			retval = recvfrom(php_sock->bsd_socket, ZSTR_VAL(recv_buf), arg3, arg4, (struct sockaddr *)&s_un, (socklen_t *)&slen);
+#endif
 
 			if (retval < 0) {
 				PHP_SOCKET_ERROR(php_sock, "unable to recvfrom", errno);
@@ -1795,9 +1830,12 @@ PHP_FUNCTION(socket_recvfrom)
 				zend_string_free(recv_buf);
 				WRONG_PARAM_COUNT;
 			}
-
+#if defined (__hpux)
+/* On HP-UX, socket APIs expect "integer" as data type for length of the "option" data structure. */
+			retval = recvfrom(php_sock->bsd_socket, ZSTR_VAL(recv_buf), arg3, arg4, (struct sockaddr *)&sin, (int *)&slen);
+#else
 			retval = recvfrom(php_sock->bsd_socket, ZSTR_VAL(recv_buf), arg3, arg4, (struct sockaddr *)&sin, (socklen_t *)&slen);
-
+#endif
 			if (retval < 0) {
 				PHP_SOCKET_ERROR(php_sock, "unable to recvfrom", errno);
 				zend_string_free(recv_buf);
@@ -1826,8 +1864,12 @@ PHP_FUNCTION(socket_recvfrom)
 				zend_string_free(recv_buf);
 				WRONG_PARAM_COUNT;
 			}
-
+#if defined (__hpux)
+/* On HP-UX, socket APIs expect "integer" as data type for length of the "option" data structure. */
+			retval = recvfrom(php_sock->bsd_socket, ZSTR_VAL(recv_buf), arg3, arg4, (struct sockaddr *)&sin6, (int *)&slen);
+#else
 			retval = recvfrom(php_sock->bsd_socket, ZSTR_VAL(recv_buf), arg3, arg4, (struct sockaddr *)&sin6, (socklen_t *)&slen);
+#endif
 
 			if (retval < 0) {
 				PHP_SOCKET_ERROR(php_sock, "unable to recvfrom", errno);
@@ -1948,7 +1990,12 @@ PHP_FUNCTION(socket_get_option)
 #ifdef PHP_WIN32
 	int				timeout = 0;
 #endif
-	socklen_t		optlen;
+#if defined (__hpux)
+/* On HP-UX, socket APIs expect "integer" as data type for length of the "option" data structure. */
+	int			optlen;
+#else
+	socklen_t               optlen;
+#endif
 	php_socket		*php_sock;
 	int				other_val;
 	zend_long			level, optname;
@@ -2336,7 +2383,12 @@ php_socket *socket_import_file_descriptor(PHP_SOCKET socket)
 #endif
 	php_socket 				*retsock;
 	php_sockaddr_storage	addr;
-	socklen_t				addr_len = sizeof(addr);
+#if defined (__hpux)
+/* On HP-UX, socket APIs expect "integer" as data type for length of the "option" data structure. */
+	int				addr_len = sizeof(addr);
+#else
+	socklen_t                               addr_len = sizeof(addr);
+#endif
 #ifndef PHP_WIN32
 	int					 t;
 #endif
@@ -2453,7 +2505,12 @@ PHP_FUNCTION(socket_export_stream)
 #endif
 	) {
 		int protoid;
+#if defined (__hpux)
+/* On HP-UX, socket APIs expect "integer" as data type for length of the "option" data structure. */
+		int	  protoidlen = sizeof(protoid);
+#else
 		socklen_t protoidlen = sizeof(protoid);
+#endif
 
 		getsockopt(socket->bsd_socket, SOL_SOCKET, SO_TYPE, (char *) &protoid, &protoidlen);
 
diff --git a/ext/standard/random.c b/ext/standard/random.c
index 627df9b..7916783 100644
--- a/ext/standard/random.c
+++ b/ext/standard/random.c
@@ -163,7 +163,12 @@ PHPAPI int php_random_bytes(void *bytes, size_t size, zend_bool should_throw)
 		}
 
 		for (read_bytes = 0; read_bytes < size; read_bytes += (size_t) n) {
+#if defined (__hpux)
+/* on HP-UX, for the "bytes" variable, do typecast from "void" to "char" pointer. */
+			n = read(fd, ((char *)bytes) + read_bytes, size - read_bytes);
+#else
 			n = read(fd, bytes + read_bytes, size - read_bytes);
+#endif
 			if (n <= 0) {
 				break;
 			}
diff --git a/main/network.c b/main/network.c
index 30e2200..8073f4c 100644
--- a/main/network.c
+++ b/main/network.c
@@ -296,7 +296,12 @@ typedef int php_non_blocking_flags_t;
 /* {{{ php_network_connect_socket */
 PHPAPI int php_network_connect_socket(php_socket_t sockfd,
 		const struct sockaddr *addr,
+#if defined (__hpux)
+/* On HP-UX, socket APIs expect "integer" as data type for length of the "option" data structure. */
+		int	 addrlen,
+#else
 		socklen_t addrlen,
+#endif
 		int asynchronous,
 		struct timeval *timeout,
 		zend_string **error_string,
@@ -306,7 +311,12 @@ PHPAPI int php_network_connect_socket(php_socket_t sockfd,
 	php_non_blocking_flags_t orig_flags;
 	int n;
 	int error = 0;
+#if defined (__hpux)
+/* On HP-UX, socket APIs expect "integer" as data type for length of the "option" data structure. */
+	int	  len;
+#else
 	socklen_t len;
+#endif
 	int ret = 0;
 
 	SET_SOCKET_BLOCKING_MODE(sockfd, orig_flags);
@@ -416,7 +426,12 @@ php_socket_t php_network_bind_socket_to_local_addr(const char *host, unsigned po
 	int num_addrs, n, err = 0;
 	php_socket_t sock;
 	struct sockaddr **sal, **psal, *sa;
+#if defined (__hpux)
+/* On HP-UX, socket APIs expect "integer" as data type for length of the "option" data structure. */
+	int	  socklen;
+#else
 	socklen_t socklen;
+#endif
 	int sockoptval = 1;
 
 	num_addrs = php_network_getaddresses(host, socktype, &psal, error_string);
@@ -512,7 +527,12 @@ bound:
 }
 /* }}} */
 
+#if defined (__hpux)
+/* On HP-UX, socket APIs expect "integer" as data type for length of the "option" data structure. */
+PHPAPI int php_network_parse_network_address_with_port(const char *addr, zend_long addrlen, struct sockaddr *sa, int *sl)
+#else
 PHPAPI int php_network_parse_network_address_with_port(const char *addr, zend_long addrlen, struct sockaddr *sa, socklen_t *sl)
+#endif
 {
 	char *colon;
 	char *tmp;
@@ -601,12 +621,22 @@ out:
 
 PHPAPI void php_network_populate_name_from_sockaddr(
 		/* input address */
+#if defined (__hpux)
+/* On HP-UX, socket APIs expect "integer" as data type for length of the "option" data structure. */
+		struct sockaddr *sa, int sl,
+#else
 		struct sockaddr *sa, socklen_t sl,
+#endif
 		/* output readable address */
 		zend_string **textaddr,
 		/* output address */
 		struct sockaddr **addr,
+#if defined (__hpux)
+/* On HP-UX, socket APIs expect "integer" as data type for length of the "option" data structure. */
+		int *addrlen
+#else
 		socklen_t *addrlen
+#endif
 		)
 {
 	if (addr) {
@@ -667,11 +697,21 @@ PHPAPI void php_network_populate_name_from_sockaddr(
 PHPAPI int php_network_get_peer_name(php_socket_t sock,
 		zend_string **textaddr,
 		struct sockaddr **addr,
+#if defined (__hpux)
+/* On HP-UX, socket APIs expect "integer" as data type for length of the "option" data structure. */
+		int 	  *addrlen
+#else
 		socklen_t *addrlen
+#endif
 		)
 {
 	php_sockaddr_storage sa;
+#if defined (__hpux)
+/* On HP-UX, socket APIs expect "integer" as data type for length of the "option" data structure. */
+	int sl = sizeof(sa);
+#else
 	socklen_t sl = sizeof(sa);
+#endif
 	memset(&sa, 0, sizeof(sa));
 
 	if (getpeername(sock, (struct sockaddr*)&sa, &sl) == 0) {
@@ -687,11 +727,21 @@ PHPAPI int php_network_get_peer_name(php_socket_t sock,
 PHPAPI int php_network_get_sock_name(php_socket_t sock,
 		zend_string **textaddr,
 		struct sockaddr **addr,
+#if defined (__hpux)
+/* On HP-UX, socket APIs expect "integer" as data type for length of the "option" data structure. */
+		int 	  *addrlen
+#else
 		socklen_t *addrlen
+#endif
 		)
 {
 	php_sockaddr_storage sa;
+#if defined (__hpux)
+/* On HP-UX, socket APIs expect "integer" as data type for length of the "option" data structure. */
+	int sl = sizeof(sa);
+#else
 	socklen_t sl = sizeof(sa);
+#endif
 	memset(&sa, 0, sizeof(sa));
 
 	if (getsockname(sock, (struct sockaddr*)&sa, &sl) == 0) {
@@ -718,7 +768,12 @@ PHPAPI int php_network_get_sock_name(php_socket_t sock,
 PHPAPI php_socket_t php_network_accept_incoming(php_socket_t srvsock,
 		zend_string **textaddr,
 		struct sockaddr **addr,
+#if defined (__hpux)
+/* On HP-UX, socket APIs expect "integer" as data type for length of the "option" data structure. */
+		int	  *addrlen,
+#else
 		socklen_t *addrlen,
+#endif
 		struct timeval *timeout,
 		zend_string **error_string,
 		int *error_code,
@@ -728,7 +783,12 @@ PHPAPI php_socket_t php_network_accept_incoming(php_socket_t srvsock,
 	php_socket_t clisock = -1;
 	int error = 0, n;
 	php_sockaddr_storage sa;
+#if defined (__hpux)
+/* On HP-UX, socket APIs expect "integer" as data type for length of the "option" data structure. */
+	int 	  sl;
+#else
 	socklen_t sl;
+#endif
 
 	n = php_pollfd_for(srvsock, PHP_POLLREADABLE, timeout);
 
@@ -784,7 +844,12 @@ php_socket_t php_network_connect_socket_to_host(const char *host, unsigned short
 	php_socket_t sock;
 	struct sockaddr **sal, **psal, *sa;
 	struct timeval working_timeout;
+#if defined (__hpux)
+/* On HP-UX, socket APIs expect "integer" as data type for length of the "option" data structure. */
+	int  socklen;
+#else
 	socklen_t socklen;
+#endif
 #if HAVE_GETTIMEOFDAY
 	struct timeval limit_time, time_now;
 #endif
diff --git a/main/php_network.h b/main/php_network.h
index 9dbb319..103634e 100644
--- a/main/php_network.h
+++ b/main/php_network.h
@@ -252,7 +252,12 @@ PHPAPI php_socket_t php_network_connect_socket_to_host(const char *host, unsigne
 
 PHPAPI int php_network_connect_socket(php_socket_t sockfd,
 		const struct sockaddr *addr,
+#if defined (__hpux)
+/* On HP-UX, socket APIs expect "integer" as data type for length of the "option" data structure. */
+		int addrlen,
+#else
 		socklen_t addrlen,
+#endif
 		int asynchronous,
 		struct timeval *timeout,
 		zend_string **error_string,
@@ -268,7 +273,12 @@ PHPAPI php_socket_t php_network_bind_socket_to_local_addr(const char *host, unsi
 PHPAPI php_socket_t php_network_accept_incoming(php_socket_t srvsock,
 		zend_string **textaddr,
 		struct sockaddr **addr,
+#if defined (__hpux)
+/* On HP-UX, socket APIs expect "integer" as data type for length of the "option" data structure. */
+		int       *addrlen,
+#else
 		socklen_t *addrlen,
+#endif
 		struct timeval *timeout,
 		zend_string **error_string,
 		int *error_code,
@@ -278,13 +288,23 @@ PHPAPI php_socket_t php_network_accept_incoming(php_socket_t srvsock,
 PHPAPI int php_network_get_sock_name(php_socket_t sock,
 		zend_string **textaddr,
 		struct sockaddr **addr,
+#if defined (__hpux)
+/* On HP-UX, socket APIs expect "integer" as data type for length of the "option" data structure. */
+		int 	  *addrlen
+#else
 		socklen_t *addrlen
+#endif
 		);
 
 PHPAPI int php_network_get_peer_name(php_socket_t sock,
 		zend_string **textaddr,
 		struct sockaddr **addr,
+#if defined (__hpux)
+/* On HP-UX, socket APIs expect "integer" as data type for length of the "option" data structure. */
+		int       *addrlen
+#else
 		socklen_t *addrlen
+#endif
 		);
 
 PHPAPI void php_any_addr(int family, php_sockaddr_storage *addr, unsigned short port);
@@ -310,17 +330,31 @@ PHPAPI php_stream *_php_stream_sock_open_host(const char *host, unsigned short p
 		int socktype, struct timeval *timeout, const char *persistent_id STREAMS_DC);
 PHPAPI void php_network_populate_name_from_sockaddr(
 		/* input address */
+#if defined (__hpux)
+/* On HP-UX, socket APIs expect "integer" as data type for length of the "option" data structure. */
+		struct sockaddr *sa, int sl,
+#else
 		struct sockaddr *sa, socklen_t sl,
+#endif
 		/* output readable address */
 		zend_string **textaddr,
 		/* output address */
 		struct sockaddr **addr,
+#if defined (__hpux)
+/* On HP-UX, socket APIs expect "integer" as data type for length of the "option" data structure. */
+		int 	 *addrlen
+#else
 		socklen_t *addrlen
+#endif
 		);
-
+#if defined (__hpux)
+/* On HP-UX, socket APIs expect "integer" as data type for length of the "option" data structure. */
+PHPAPI int php_network_parse_network_address_with_port(const char *addr,
+		zend_long addrlen, struct sockaddr *sa, int *sl);
+#else
 PHPAPI int php_network_parse_network_address_with_port(const char *addr,
 		zend_long addrlen, struct sockaddr *sa, socklen_t *sl);
-
+#endif
 PHPAPI struct hostent*	php_network_gethostbyname(char *name);
 
 PHPAPI int php_set_sock_blocking(php_socket_t socketd, int block);
diff --git a/sapi/apache2handler/php_functions.c b/sapi/apache2handler/php_functions.c
index 572aa98..aa5c846 100644
--- a/sapi/apache2handler/php_functions.c
+++ b/sapi/apache2handler/php_functions.c
@@ -46,6 +46,11 @@
 #include "unixd.h"
 #endif
 
+#if defined (__hpux)
+/* HP-UX include following header to get the latest version of apache modules */
+#include "ap_mmn.h"
+#endif
+
 #include "php_apache.h"
 
 #ifdef ZTS
diff --git a/sapi/phpdbg/phpdbg_out.h b/sapi/phpdbg/phpdbg_out.h
index 4d264ba..27d6113 100644
--- a/sapi/phpdbg/phpdbg_out.h
+++ b/sapi/phpdbg/phpdbg_out.h
@@ -40,6 +40,17 @@ PHPDBG_API int phpdbg_log_internal(int fd, const char *fmt, ...) PHP_ATTRIBUTE_F
 PHPDBG_API int phpdbg_out_internal(int fd, const char *fmt, ...) PHP_ATTRIBUTE_FORMAT(printf, 2, 3);
 PHPDBG_API int phpdbg_rlog_internal(int fd, const char *fmt, ...) PHP_ATTRIBUTE_FORMAT(printf, 2, 3);
 
+#if defined ( __hppa)
+/* Compiler of HP-UX on PA-RISC platform,  does not support "variable arguments". */
+#define phpdbg_error(tag, xmlfmt, strfmt, ...)              phpdbg_print(P_ERROR  , PHPDBG_G(io)[PHPDBG_STDOUT].fd, tag,  xmlfmt, strfmt)
+#define phpdbg_notice(tag, xmlfmt, strfmt, ...)             phpdbg_print(P_NOTICE , PHPDBG_G(io)[PHPDBG_STDOUT].fd, tag,  xmlfmt, strfmt)
+#define phpdbg_writeln(tag, xmlfmt, strfmt, ...)            phpdbg_print(P_WRITELN, PHPDBG_G(io)[PHPDBG_STDOUT].fd, tag,  xmlfmt, strfmt)
+#define phpdbg_write(tag, xmlfmt, strfmt, ...)              phpdbg_print(P_WRITE  , PHPDBG_G(io)[PHPDBG_STDOUT].fd, tag,  xmlfmt, strfmt)
+#define phpdbg_script(type, fmt, ...)                       phpdbg_print(type     , PHPDBG_G(io)[PHPDBG_STDOUT].fd, NULL, NULL,   fmt)
+#define phpdbg_log(fmt, ...) phpdbg_log_internal(PHPDBG_G(io)[PHPDBG_STDOUT].fd, fmt)
+#define phpdbg_xml(fmt, ...) phpdbg_xml_internal(PHPDBG_G(io)[PHPDBG_STDOUT].fd, fmt)
+#define phpdbg_out(fmt, ...) phpdbg_out_internal(PHPDBG_G(io)[PHPDBG_STDOUT].fd, fmt)
+#else
 #define phpdbg_error(tag, xmlfmt, strfmt, ...)              phpdbg_print(P_ERROR  , PHPDBG_G(io)[PHPDBG_STDOUT].fd, tag,  xmlfmt, strfmt, ##__VA_ARGS__)
 #define phpdbg_notice(tag, xmlfmt, strfmt, ...)             phpdbg_print(P_NOTICE , PHPDBG_G(io)[PHPDBG_STDOUT].fd, tag,  xmlfmt, strfmt, ##__VA_ARGS__)
 #define phpdbg_writeln(tag, xmlfmt, strfmt, ...)            phpdbg_print(P_WRITELN, PHPDBG_G(io)[PHPDBG_STDOUT].fd, tag,  xmlfmt, strfmt, ##__VA_ARGS__)
@@ -48,6 +59,7 @@ PHPDBG_API int phpdbg_rlog_internal(int fd, const char *fmt, ...) PHP_ATTRIBUTE_
 #define phpdbg_log(fmt, ...) phpdbg_log_internal(PHPDBG_G(io)[PHPDBG_STDOUT].fd, fmt, ##__VA_ARGS__)
 #define phpdbg_xml(fmt, ...) phpdbg_xml_internal(PHPDBG_G(io)[PHPDBG_STDOUT].fd, fmt, ##__VA_ARGS__)
 #define phpdbg_out(fmt, ...) phpdbg_out_internal(PHPDBG_G(io)[PHPDBG_STDOUT].fd, fmt, ##__VA_ARGS__)
+#endif
 
 #define phpdbg_error_ex(out, tag, xmlfmt, strfmt, ...)      phpdbg_print(P_ERROR  , out, tag,  xmlfmt, strfmt, ##__VA_ARGS__)
 #define phpdbg_notice_ex(out, tag, xmlfmt, strfmt, ...)     phpdbg_print(P_NOTICE , out, tag,  xmlfmt, strfmt, ##__VA_ARGS__)
-- 
2.15.1

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Nov 24 18:01:32 2024 UTC