php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36458 function sleep accept negative value
Submitted: 2006-02-20 04:24 UTC Modified: 2006-02-21 16:35 UTC
From: quick_defect at yahoo dot com Assigned:
Status: Closed Package: Unknown/Other Function
PHP Version: 5.1.2 OS: redhat
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
8 + 8 = ?
Subscribe to this entry?

 
 [2006-02-20 04:24 UTC] quick_defect at yahoo dot com
Description:
------------
First,if given negative value, I have to interrupt the execution of scripts because it sleep for very long time.(I did not exactly know how long)
Second,if given a int which cause overflow, it also do not work very well.

Reproduce code:
---------------
sleep(-1);
$max=mt_getrandmax();
$of=-$max-2;
sleep($of);

Expected result:
----------------
exception or turn it to a legal value

Actual result:
--------------
sleep for a very long time


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-02-20 08:20 UTC] derick@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.1-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.1-win32-latest.zip
 [2006-02-21 09:14 UTC] quick_defect at yahoo dot com
Nothing diffrent...the same as before
 [2006-02-21 09:19 UTC] quick_defect at yahoo dot com
But I see that the behavior of function usleep reasonable this time: warning messages are given and exit endless sleep.But why function sleep remains? PLS fix it.
 [2006-02-21 16:35 UTC] iliaa@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 05:01:29 2024 UTC