iliaa Tue Feb 21 15:35:01 2006 UTC Modified files: (Branch: PHP_4_4) /php-src/ext/standard basic_functions.c /php-src NEWS Log: MFH: Fixed bug #36458 (sleep() accepts negative values). http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/basic_functions.c?r1=1.543.2.51.2.6&r2=1.543.2.51.2.7&diff_format=u Index: php-src/ext/standard/basic_functions.c diff -u php-src/ext/standard/basic_functions.c:1.543.2.51.2.6 php-src/ext/standard/basic_functions.c:1.543.2.51.2.7 --- php-src/ext/standard/basic_functions.c:1.543.2.51.2.6 Sun Jan 1 13:46:57 2006 +++ php-src/ext/standard/basic_functions.c Tue Feb 21 15:35:01 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: basic_functions.c,v 1.543.2.51.2.6 2006/01/01 13:46:57 sniper Exp $ */ +/* $Id: basic_functions.c,v 1.543.2.51.2.7 2006/02/21 15:35:01 iliaa Exp $ */ #include "php.h" #include "php_streams.h" @@ -1662,14 +1662,16 @@ Delay for a given number of seconds */ PHP_FUNCTION(sleep) { - pval **num; - - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) { - WRONG_PARAM_COUNT; + long num; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &num) == FAILURE) { + RETURN_FALSE; } - - convert_to_long_ex(num); - php_sleep(Z_LVAL_PP(num)); + if (num < 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number of seconds must be greater than or equal to 0"); + RETURN_FALSE; + } + php_sleep(num); } /* }}} */ @@ -1678,13 +1680,16 @@ PHP_FUNCTION(usleep) { #if HAVE_USLEEP - pval **num; - - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) { - WRONG_PARAM_COUNT; + long num; + + 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 microseconds must be greater than or equal to 0"); + RETURN_FALSE; } - convert_to_long_ex(num); - usleep(Z_LVAL_PP(num)); + usleep(num); #endif } /* }}} */ http://cvs.php.net/viewcvs.cgi/php-src/NEWS?r1=1.1247.2.920.2.116&r2=1.1247.2.920.2.117&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.1247.2.920.2.116 php-src/NEWS:1.1247.2.920.2.117 --- php-src/NEWS:1.1247.2.920.2.116 Mon Feb 13 12:19:09 2006 +++ php-src/NEWS Tue Feb 21 15:35:01 2006 @@ -2,6 +2,7 @@ ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2006, Version 4.4.3 - Added a check for special characters in the session name. (Ilia) +- Fixed bug #36458 (sleep() accepts negative values). (Ilia) - Fixed bug #36242 (Possible memory corruption in stream_select()). (Tony) - Fixed bug #36223 (curl bypasses open_basedir restrictions). (Tony) - Fixed bug #36205 (Memory leaks on duplicate cookies). (Dmitry)
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php