Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-72359

32 Bit PHP autoconverts analysable::MAX_TIME (9999999999) to double

    XMLWordPrintable

Details

    • Bug
    • Status: Waiting for peer review
    • Minor
    • Resolution: Unresolved
    • 3.9.9, 3.11.2, 3.11.11, 4.0, 4.0.5, 4.1
    • None
    • Analytics
    • PHP 7.4 32-Bit version
    • MOODLE_311_STABLE, MOODLE_39_STABLE, MOODLE_400_STABLE, MOODLE_401_STABLE
    • MDL-72359-master-change-max-time
    • Hide

      1. Run the scheduled task on a 32 Bit PHP. Confirm it doesn't throw the warning described in the issue.
      2. Run the scheduled task on a 64 Bit PHP. Confirm it doesn't throw the warning described in the issue.

      Show
      1. Run the scheduled task on a 32 Bit PHP. Confirm it doesn't throw the warning described in the issue. 2. Run the scheduled task on a 64 Bit PHP. Confirm it doesn't throw the warning described in the issue.

    Description

      https://github.com/moodle/moodle/blob/036800d99debfe61dde45f61292bc5ad44ab7cb0/analytics/classes/analysable.php#L41

      defines a constant that is used in the user.php analysable here:
      https://github.com/moodle/moodle/blob/036800d99debfe61dde45f61292bc5ad44ab7cb0/analytics/classes/user.php#L190-L192

      This again is used in the time splitting periodic class here
      https://github.com/moodle/moodle/blob/036800d99debfe61dde45f61292bc5ad44ab7cb0/analytics/classes/local/time_splitting/periodic.php#L82-L84

      DateTimeImmutable needs an int timestamp to work. 32 Bit PHP can't handle the integer value 9999999999, so it converts it to float. This leads to the warning:

      PHP Warning: DateTimeImmutable::setTimestamp() expects parameter 1 to be integer, float given in /moodle/application/htdocs/moodle/moodle_stacks/analytics/classes/local/time_splitting/periodic.php on line 83

      Possible solution: Smaller value for timestamp?

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              poggenpohlda Daniel Poggenpohl
              David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated: