Issue #51 on hold

Date class: timestamp outside valid range

Hans van der Weij
created an issue

/classes/CircQuery uses date::daysLater for managing the hold queue at checkout and late fee at check in. This was introduced on 0.7.0.

Currently this should be only problematic for late fee calculation because Override Due Date enables user input. This can result in unjust late fees calculated at check in.

Comments (3)

  1. Hans van der Weij reporter

    Temporary fix: https://bitbucket.org/jgvdweij/obiblio/changeset/0f26f1c0c682

    Should work until Y2K38. Then hold queue can become a problem too.

    More on the issue:

    When at Check Out, Override Due Date is used, at Check In overdue can be calculated incorrectly, resulting in unjust late fees. Invalid due date ranges for 32 bit systems: (yyyy-mm-dd)

    • after 2038-01-19
    • before 1970-01-01 or before 1901-12-14 (depending on system)

    It depends on the system if a timestamp is outside of valid range. Examples:

    • For 64-bit versions of PHP, the valid range of a timestamp is effectively infinite.
    • Windows / PHP 5.0.0 (32 bit): at check in overdue calculated correctly for due dates from 1970-01-02 until 2038-01-19. Dates outside this range are ignored by the temporary fix.

    More detail on PHP:strtotime http://php.net/manual/en/function.strtotime.php

  2. Log in to comment