php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53409 sleep() return NULL
Submitted: 2010-11-25 22:45 UTC Modified: 2010-11-26 19:27 UTC
From: webmaster at skarmflyg dot org Assigned: pajoye (profile)
Status: Closed Package: Unknown/Other Function
PHP Version: 5.3.3 OS: pajoye
Private report: No CVE-ID: None
 [2010-11-25 22:45 UTC] webmaster at skarmflyg dot org
Description:
------------
---
From manual page: http://www.php.net/function.sleep#Return Values
---
Sleep should return int or possibly boolean false but returns NULL.

Using 
PHP 5.3.3 
Apache 2.2.6
Windows XP SP3

Test script:
---------------
$x=sleep(1);
var_dump($x);  // Outputs NULL. Expected int 0.

Expected result:
----------------
According to documentation $x should be integer 0 or possibly false.

Actual result:
--------------
Variable $x becomes NULL.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-11-25 23:57 UTC] [email protected]
-Status: Open +Status: To be documented
 [2010-11-25 23:57 UTC] [email protected]
Sleep on windows returns nothing as well as some other platforms.

The result of sleep is actually platform dependent (NULL/FALSE or 0/FALSE).
 [2010-11-26 10:17 UTC] [email protected]
-Status: To be documented +Status: Assigned -Type: Bug +Type: Documentation Problem -Package: Unknown/Other Function +Package: Documentation problem -Assigned To: +Assigned To: aharvey
 [2010-11-26 10:19 UTC] [email protected]
Automatic comment from SVN on behalf of aharvey
Revision: http://svn.php.net/viewvc/?view=revision&revision=305764
Log: Fix doc bug #53409 (sleep() return NULL).
 [2010-11-26 10:19 UTC] [email protected]
-Status: Assigned +Status: Closed
 [2010-11-26 10:19 UTC] [email protected]
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 [2010-11-26 12:44 UTC] [email protected]
-Status: Closed +Status: Re-Opened -Type: Documentation Problem +Type: Bug -Package: Documentation problem +Package: Unknown/Other Function -Operating System: Windows XP +Operating System: pajoye -Assigned To: aharvey +Assigned To: pajoye
 [2010-11-26 12:44 UTC] [email protected]
After quick discussion on IRC;
Windows does actually have a way to provide the same functionality as, f.e., 
Linux by using SleepEx().

Re-classifying as php-src bug & assign to Pierre.
 [2010-11-26 19:25 UTC] [email protected]
Automatic comment from SVN on behalf of pajoye
Revision: http://svn.php.net/viewvc/?view=revision&revision=305778
Log: - Fixed #53409, sleep() return NULL on Windows
 [2010-11-26 19:27 UTC] [email protected]
-Status: Re-Opened +Status: Closed
 [2010-11-26 19:27 UTC] [email protected]
Fixed in 5.3 and trunk
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Dec 25 23:00:01 2025 UTC