Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.0.0

Bug #19121 System_Daemon::iterate problem & fix
Submitted: 2011-12-10 09:01 UTC
From: cp Assigned: kvz
Status: Closed Package: System_Daemon (version 1.0.0RC1)
PHP Version: 5.3.8 OS: CentOS
Roadmaps: (Not assigned)    
Subscription  


 [2011-12-10 09:01 UTC] cp (Carl Prinsloo)
Description: ------------ Some users (like me) might use a large value for $sleepSeconds. This will cause usleep to throw a warning Test script: --------------- System_Daemon::iterate(3600) /*This will not work and a warning will be logged: warning: [PHP Warning] usleep(): Number of microseconds must be greater than or equal to 0 */ Expected result: ---------------- A possible fix would be to change the following in Daemon.php: self::_optionObjSetup(); if ($sleepSeconds !== 0) { usleep($sleepSeconds*1000000); } ...to something like this: self::_optionObjSetup(); if ($sleepSeconds !== 0) { if($sleepSeconds > 2147) $sleepSeconds = 2147; usleep($sleepSeconds*1000000); }

Comments

 [2012-01-14 11:48 UTC] jrbasso (Juan Basso)
Instead of limit the max of seconds, you can use sleep() instead of usleep().
 [2012-01-24 19:16 UTC] kvz (Kevin van Zonneveld)
-Status: Open +Status: Closed -Assigned To: +Assigned To: kvz
This bug has been fixed in SVN. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. https://github.com/kvz/system_daemon/commit/d5a59aa2e416e910cf8f62afbbe9634 9557f0262 Thanks for reporting