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

Fix cases of continue within switch statements

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Verify that not breakage happens via automated tests.

      With PHP 7.3 it would be possible to verify that the "PHP Warning" is not shown, but that has been already verified in the Epic issue with this patch applied. So testing that everything continues working in automated tests should be enough.

      Show
      Verify that not breakage happens via automated tests. With PHP 7.3 it would be possible to verify that the "PHP Warning" is not shown, but that has been already verified in the Epic issue with this patch applied. So testing that everything continues working in automated tests should be enough.
    • Affected Branches:
      MOODLE_36_STABLE
    • Fixed Branches:
      MOODLE_36_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      Description

      With PHP 7.3 a warning has been added (about an existing problem) when continue; commands are used within switch statements. Really they act as normal break; statements there and, if within a loop, we should be using continue 2; instead.

      PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"

      Link: https://github.com/php/php-src/blob/PHP-7.3/UPGRADING
      PHPUnit run: https://pastebin.com/pLcjfX3V

      This is about to find all those continue uses within switch statements and replace them with the correct statement when needed.

      Some links explaining continue within switch and loops:

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                stronk7 Eloy Lafuente (stronk7)
                Reporter:
                stronk7 Eloy Lafuente (stronk7)
                Peer reviewer:
                Víctor Déniz Falcón
                Integrator:
                Andrew Nicols
                Tester:
                CiBoT
                Participants:
                Component watchers:
                Elizabeth Dalton, David Monllaó, Damyon Wiese, Adrian Greeve, Mihail Geshoski, Peter Dias, Adrian Greeve, Mihail Geshoski, Peter Dias, Jake Dallimore, Jun Pataleta, Ryan Wyllie, Dan Marsden, Jake Dallimore, Jun Pataleta, Ryan Wyllie, Damyon Wiese, Jean-Philippe Gaudreau, Steve Massicotte, Serge Gauthier, Issam Taboubi, Adrian Greeve, Mihail Geshoski, Peter Dias, Adrian Greeve, Mihail Geshoski, Peter Dias, Amaia Anabitarte, Bas Brands, Carlos Escobedo, Sara Arjona (@sarjona), Víctor Déniz Falcón, Andrew Nicols, Mathew May, Michael Hawkins, Shamim Rezaie, Simey Lameze, Jake Dallimore, Jun Pataleta, Ryan Wyllie, Adrian Greeve, Mihail Geshoski, Peter Dias, Jake Dallimore, Jun Pataleta, Ryan Wyllie, Adrian Greeve, Mihail Geshoski, Peter Dias, Amaia Anabitarte, Bas Brands, Carlos Escobedo, Sara Arjona (@sarjona), Víctor Déniz Falcón, Tim Hunt, Andrew Nicols, Mathew May, Michael Hawkins, Shamim Rezaie, Simey Lameze, Damyon Wiese, Dan Marsden, Matteo Scaramuccia, Adrian Greeve, Mihail Geshoski, Peter Dias, Amaia Anabitarte, Bas Brands, Carlos Escobedo, Sara Arjona (@sarjona), Víctor Déniz Falcón
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  3/Dec/18