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

mod_scorm PHP7 breakages

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.8.8, 2.9.2
    • Fix Version/s: 2.9.4, 3.0.1
    • Component/s: SCORM
    • Labels:
    • Testing Instructions:
      Hide

      This makes changes to SCORM 2004 code related to sequencing and navigation which was never completed (and is not supported) These changes are required due to dodgy code which triggers PHP 7 errors.

      The only test required for this change is to run PHP 7 lint on the SCORM code and make sure it passes.

      Show
      This makes changes to SCORM 2004 code related to sequencing and navigation which was never completed (and is not supported) These changes are required due to dodgy code which triggers PHP 7 errors. The only test required for this change is to run PHP 7 lint on the SCORM code and make sure it passes.
    • Affected Branches:
      MOODLE_28_STABLE, MOODLE_29_STABLE
    • Fixed Branches:
      MOODLE_29_STABLE, MOODLE_30_STABLE
    • Pull Master Branch:
      master_MDL-51757

      Description

      As picked up in MDL-51011:

      diff --git a/mod/scorm/datamodels/scorm_13lib.php b/mod/scorm/datamodels/scorm_13lib.php
      index b883223..ac9b80d 100644
      --- a/mod/scorm/datamodels/scorm_13lib.php
      +++ b/mod/scorm/datamodels/scorm_13lib.php
      @@ -1108,7 +1108,7 @@ function scorm_seq_flow_tree_traversal($activity, $direction, $childrenflag, $pr
       }
       
       // Returns the next activity on the tree, traversal direction, control returned to the LTS, (may) exception.
      -function scorm_seq_flow_activity_traversal ($activity, $userid, $direction, $childrenflag, $prevdirection, $seq, $userid) {
      +function scorm_seq_flow_activity_traversal ($activity, $userid, $direction, $childrenflag, $prevdirection, $seq, $unused = null) {
           $parent = scorm_get_parent ($activity);
           if (!isset($parent->flow) || ($parent->flow == false)) {
               $seq->deliverable = false;
      diff --git a/mod/scorm/datamodels/sequencinglib.php b/mod/scorm/datamodels/sequencinglib.php
      index 497206e..def1319 100644
      --- a/mod/scorm/datamodels/sequencinglib.php
      +++ b/mod/scorm/datamodels/sequencinglib.php
      @@ -421,7 +421,7 @@ function scorm_seq_choice_sequencing($sco, $userid, $seq) {
           }
       
           if ($seq->currentactivity === $sco) {
      -        break;
      +        throw new \coding_exception('Unexpected state encountered');
           }
       
           $sib = scorm_get_siblings($seq->currentactivity);
      @@ -451,7 +451,7 @@ function scorm_seq_choice_sequencing($sco, $userid, $seq) {
                       return $seq;
                   }
               }
      -        break;
      +        throw new \coding_exception('Unexpected state encountered');
           }
       
           if ($seq->currentactivity == null || $seq->currentactivity == $comancestor) {
      @@ -478,7 +478,7 @@ function scorm_seq_choice_sequencing($sco, $userid, $seq) {
                       return $seq;
                   }
               }
      -        break;
      +        throw new \coding_exception('Unexpected state encountered');
           }
       
           if ($comancestor->id == $sco->id) {
      @@ -504,7 +504,7 @@ function scorm_seq_choice_sequencing($sco, $userid, $seq) {
                       }
                   }
               }
      -        break;
      +        throw new \coding_exception('Unexpected state encountered');
           }
       
           if (array_search($ancestors, $comancestor) !== false) {
      @@ -589,7 +589,7 @@ function scorm_seq_choice_sequencing($sco, $userid, $seq) {
                       }
                   }
               }
      -        break;
      +        throw new \coding_exception('Unexpected state encountered');
           }
       
           if (scorm_is_leaf ($sco)) {
      

        Attachments

          Activity

            People

            Assignee:
            danmarsden Dan Marsden
            Reporter:
            dobedobedoh Andrew Nicols
            Integrator:
            Dan Poltawski
            Tester:
            cameron1729
            Participants:
            Component watchers:
            Damyon Wiese, Dan Marsden, Matteo Scaramuccia, Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              21/Dec/15