FAQ
Edit report at http://pear.php.net/bugs/bug.php?id=19121&edit=1

ID: 19121
Comment by: jrbasso
Reported By: jrbasso at gmail dot com
Summary: System_Daemon::iterate problem & fix
Status: Open
Type: Bug
Package: System_Daemon
Operating System: CentOS
Package Version: 1.0.0RC1
PHP Version: 5.3.8
New Comment:

Instead of limit the max of seconds, you can use sleep() instead of
usleep().


Previous Comments:
------------------------------------------------------------------------

[2011-12-10 04:01:17] cp

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);
}

------------------------------------------------------------------------

Search Discussions

  • Kvz at Jan 24, 2012 at 1:14 pm
    Edit report at https://pear.php.net/bugs/bug.php?id=19121&edit=1

    ID: 19121
    Updated by: kvz@php.net
    Reported By: carlprinsloo at gmail dot com
    Summary: System_Daemon::iterate problem & fix
    -Status: Open
    +Status: Closed
    Type: Bug
    Package: System_Daemon
    Operating System: CentOS
    Package Version: 1.0.0RC1
    PHP Version: 5.3.8
    -Assigned To:
    +Assigned To: kvz
    Roadmap Versions:
    New Comment:

    -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


    Previous Comments:
    ------------------------------------------------------------------------

    [2012-01-14 06:48:18] jrbasso

    Instead of limit the max of seconds, you can use sleep() instead of
    usleep().

    ------------------------------------------------------------------------

    [2011-12-10 04:01:17] cp

    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);
    }

    ------------------------------------------------------------------------

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedJan 14, '12 at 5:48a
activeJan 24, '12 at 1:14p
posts2
users2
websitepear.php.net

2 users in discussion

Jrbasso: 1 post Kvz: 1 post

People

Translate

site design / logo © 2022 Grokbase