tony2001                Thu Feb 16 10:13:24 2006 UTC

  Modified files:              
    /php-src/ext/standard       basic_functions.c 
  Log:
  improve usleep(): use new param parsing API, check for negative values
  (related to #36410)
  
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/basic_functions.c?r1=1.749&r2=1.750&diff_format=u
Index: php-src/ext/standard/basic_functions.c
diff -u php-src/ext/standard/basic_functions.c:1.749 
php-src/ext/standard/basic_functions.c:1.750
--- php-src/ext/standard/basic_functions.c:1.749        Sat Jan 28 06:16:32 2006
+++ php-src/ext/standard/basic_functions.c      Thu Feb 16 10:13:23 2006
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: basic_functions.c,v 1.749 2006/01/28 06:16:32 fmk Exp $ */
+/* $Id: basic_functions.c,v 1.750 2006/02/16 10:13:23 tony2001 Exp $ */
 
 #include "php.h"
 #include "php_streams.h"
@@ -1770,13 +1770,16 @@
 PHP_FUNCTION(usleep)
 {
 #if HAVE_USLEEP
-       zval **num;
+       long num;
 
-       if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) 
{
-               WRONG_PARAM_COUNT;
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &num) == 
FAILURE) {
+               return;
        }
-       convert_to_long_ex(num);
-       usleep(Z_LVAL_PP(num));
+       if (num < 0) {
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number of 
microseconds must be greater than or equal to 0");
+               RETURN_FALSE;
+       }
+       usleep(num);
 #endif
 }
 /* }}} */

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to