php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37354 sleep() does not work as expected
Submitted: 2006-05-08 00:09 UTC Modified: 2006-05-08 13:19 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: jbricci at gmail dot com Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 5.1.4 OS: Windows 2003 ISAPI
Private report: No CVE-ID: None
 [2006-05-08 00:09 UTC] jbricci at gmail dot com
Description:
------------
sleep() does not work as it did before...

sleep() now only seems to work up to a certain number of seconds, I haven't figured what that number is. But if this now how sleep() will work in PHP, could you please add the maximum value, (number of seconds allowed to be used in sleep()) to the manual.

Reproduce code:
---------------
<?

// some ridiculous amount of time..

sleep ( 63166608000 );

?>

Expected result:
----------------
script should sleep...

Actual result:
--------------
script continues without sleeping, and triggers a warning, that makes no sense at all. 

PHP Warning:  sleep() [<a href='function.sleep'>function.sleep</a>]: Number of seconds must be greater than or equal to 0 in x:\www\docs\run\load.php on line 4


PHP 5.1.3 and in older versions, sleep() would sleep, no matter how many seconds were used! snaps.php.net (5.2.dev-latest, 6.0-dev-latest) also seem to follow version 5.1.3 and older version, sleeping no matter how many seconds are used in sleep()!


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-05-08 08:24 UTC] judas dot iscariote at gmail dot com
works perfectly fine in linux.. this may be a Windows only issue ..
 [2006-05-08 13:19 UTC] iliaa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

PHP numbers sizes are limited by the bitsize of your system. 
For example when you create a number in excess of 2.14 billion 
it overflows the integer causing it to go into the negative 
teritory, hence the error message.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 10 11:01:33 2025 UTC