]> granicus.if.org Git - php/commitdiff
Fixed bug #35900 (stream_select() should warning when tv_sec is negative).
authorIlia Alshanetsky <iliaa@php.net>
Thu, 23 Feb 2006 18:28:08 +0000 (18:28 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Thu, 23 Feb 2006 18:28:08 +0000 (18:28 +0000)
NEWS
ext/standard/streamsfuncs.c

diff --git a/NEWS b/NEWS
index 42f8fba510f75832bc5e2dd062b650a8a353e964..32b4f58fdbf7fc9ae53e2f0f1be9094ca48a4ec7 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -97,6 +97,8 @@ PHP                                                                        NEWS
 - Fixed bug #35998 (SplFileInfo::getPathname() returns unix style filenames
   in win32). (Marcus)
 - Fixed bug #35954 (Fatal com_exception casting object). (Rob)
+- Fixed bug #35900 (stream_select() should warning when tv_sec is negative).
+  (Ilia)
 - Fixed bug #34272 (empty array onto COM object blows up). (Rob)
 
 12 Jan 2006, PHP 5.1.2
index 72153cb3925b476e044951c122a17e541fc4310b..fb5ec221c467f41ea96a35bfb713a2cd89fe4d20 100644 (file)
@@ -752,6 +752,14 @@ PHP_FUNCTION(stream_select)
        if (sec != NULL) {
                convert_to_long(sec);
 
+               if (sec < 0) {
+                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "The seconds parameter must be greater then 0.");
+                       RETURN_FALSE;
+               } else if (usec < 0) {
+                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "The microseconds parameter must be greater then 0.");
+                       RETURN_FALSE;
+               }
+
                /* Solaris + BSD do not like microsecond values which are >= 1 sec */
                if (usec > 999999) {
                        tv.tv_sec = Z_LVAL_P(sec) + (usec / 1000000);