iliaa           Tue Feb 21 15:32:34 2006 UTC

  Modified files:              
    /php-src/ext/standard       basic_functions.c 
  Log:
  MFB51: Fixed bug #36458 (sleep() accepts negative values).
  
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/basic_functions.c?r1=1.754&r2=1.755&diff_format=u
Index: php-src/ext/standard/basic_functions.c
diff -u php-src/ext/standard/basic_functions.c:1.754 
php-src/ext/standard/basic_functions.c:1.755
--- php-src/ext/standard/basic_functions.c:1.754        Mon Feb 20 17:14:18 2006
+++ php-src/ext/standard/basic_functions.c      Tue Feb 21 15:32:34 2006
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: basic_functions.c,v 1.754 2006/02/20 17:14:18 dmitry Exp $ */
+/* $Id: basic_functions.c,v 1.755 2006/02/21 15:32:34 iliaa Exp $ */
 
 #include "php.h"
 #include "php_streams.h"
@@ -1677,17 +1677,19 @@
    Delay for a given number of seconds */
 PHP_FUNCTION(sleep)
 {
-       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_FALSE;
+       }
+       if (num < 0) {
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number of seconds 
must be greater than or equal to 0");
+               RETURN_FALSE;
        }
-
-       convert_to_long_ex(num);
 #ifdef PHP_SLEEP_NON_VOID
-       RETURN_LONG(php_sleep(Z_LVAL_PP(num)));
+       RETURN_LONG(php_sleep(num));
 #else
-       php_sleep(Z_LVAL_PP(num));
+       php_sleep(num);
 #endif
 
 }

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

Reply via email to