|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 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)
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);
}
/* }}} */
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
}
/* }}} */