From f4a75d91d24bd07cdf7fea5897a1d5efd9f4679e Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Mon, 11 Sep 2006 14:52:21 +0000 Subject: [PATCH] Fixed bug #38096 (large timeout values ignored on 32bit machines in stream_socket_accept() and stream_socket_client()). --- NEWS | 2 ++ ext/standard/streamsfuncs.c | 10 ++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index d77d908604..647c082f45 100644 --- a/NEWS +++ b/NEWS @@ -14,6 +14,8 @@ - Fixed bug #38661 (mixed-case URL breaks url-wrappers). (Ilia) - Fixed bug #38464 (array_count_values() mishandles numeric strings). (php_lists at realplain dot com, Ilia) +- Fixed bug #38096 (large timeout values ignored on 32bit machines in + stream_socket_accept() and stream_socket_client()). (Ilia) 31 Aug 2006, PHP 5.2.0RC3 - Updated PCRE to version 6.7. (Ilia) diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c index a9c5b85751..15fc3da32c 100644 --- a/ext/standard/streamsfuncs.c +++ b/ext/standard/streamsfuncs.c @@ -33,8 +33,10 @@ #ifndef PHP_WIN32 #define php_select(m, r, w, e, t) select(m, r, w, e, t) +typedef unsigned long long php_timeout_ull; #else #include "win32/select.h" +typedef unsigned __int64 php_timeout_ull; #endif static php_stream_context *decode_context_param(zval *contextresource TSRMLS_DC); @@ -81,7 +83,7 @@ PHP_FUNCTION(stream_socket_client) int host_len; zval *zerrno = NULL, *zerrstr = NULL, *zcontext = NULL; double timeout = FG(default_socket_timeout); - unsigned long conv; + php_timeout_ull conv; struct timeval tv; char *hashkey = NULL; php_stream *stream = NULL; @@ -103,7 +105,7 @@ PHP_FUNCTION(stream_socket_client) } /* prepare the timeout value for use */ - conv = (unsigned long) (timeout * 1000000.0); + conv = (php_timeout_ull) (timeout * 1000000.0); tv.tv_sec = conv / 1000000; tv.tv_usec = conv % 1000000; @@ -231,7 +233,7 @@ PHP_FUNCTION(stream_socket_accept) { double timeout = FG(default_socket_timeout); zval *peername = NULL; - unsigned long conv; + php_timeout_ull conv; struct timeval tv; php_stream *stream = NULL, *clistream = NULL; zval *zstream; @@ -245,7 +247,7 @@ PHP_FUNCTION(stream_socket_accept) php_stream_from_zval(stream, &zstream); /* prepare the timeout value for use */ - conv = (unsigned long) (timeout * 1000000.0); + conv = (php_timeout_ull) (timeout * 1000000.0); tv.tv_sec = conv / 1000000; tv.tv_usec = conv % 1000000; -- 2.40.0