iliaa Tue Feb 21 15:32:06 2006 UTC Modified files: (Branch: PHP_5_1) /php-src NEWS /php-src/ext/standard basic_functions.c Log: Fixed bug #36458 (sleep() accepts negative values). http://cvs.php.net/viewcvs.cgi/php-src/NEWS?r1=1.2027.2.422&r2=1.2027.2.423&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.422 php-src/NEWS:1.2027.2.423 --- php-src/NEWS:1.2027.2.422 Mon Feb 20 23:33:32 2006 +++ php-src/NEWS Tue Feb 21 15:32:06 2006 @@ -25,6 +25,7 @@ (Mike) - Fixed tiger hash algorithm generating wrong results on big endian platforms. (Mike) +- Fixed bug #36458 (sleep() accepts negative values). (Ilia) - Fixed bug #36436 (DBA problem with Berkeley DB4). (Marcus) - Fixed bug #36434 (Improper resolution of declaring class name of an inherited property). (Ilia) http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/basic_functions.c?r1=1.725.2.22&r2=1.725.2.23&diff_format=u Index: php-src/ext/standard/basic_functions.c diff -u php-src/ext/standard/basic_functions.c:1.725.2.22 php-src/ext/standard/basic_functions.c:1.725.2.23 --- php-src/ext/standard/basic_functions.c:1.725.2.22 Sat Feb 18 05:41:59 2006 +++ php-src/ext/standard/basic_functions.c Tue Feb 21 15:32:06 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: basic_functions.c,v 1.725.2.22 2006/02/18 05:41:59 rasmus Exp $ */ +/* $Id: basic_functions.c,v 1.725.2.23 2006/02/21 15:32:06 iliaa Exp $ */ #include "php.h" #include "php_streams.h" @@ -1747,17 +1747,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