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

ext/standard/streamsfuncs.c

index 9b5818a9b19ea6f692e89b01a110b5c5c8d92254..3d5391a04a9323abdd54b2ac8798d3fe92cfc1b7 100644 (file)
@@ -763,6 +763,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);