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

Fix cases of continue within switch statements

    XMLWordPrintable

Details

    • MOODLE_36_STABLE
    • MOODLE_36_STABLE
    • 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.

    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

        1. continue_in_a_loop.txt
          5 kB
          Eloy Lafuente (stronk7)
        2. continue_in_switch_case.txt
          1 kB
          Eloy Lafuente (stronk7)

        Issue Links

          Activity

            People

              stronk7 Eloy Lafuente (stronk7)
              stronk7 Eloy Lafuente (stronk7)
              Victor Déniz Falcón Victor Déniz Falcón
              Andrew Lyons Andrew Lyons
              CiBoT CiBoT
              David Woloszyn, Huong Nguyen, Jake Dallimore, Michael Hawkins, Stevani Andolo, Adrian Greeve, Ilya Tregubov, Kevin Percy, Mathew May, Mihail Geshoski, Shamim Rezaie, Ilya Tregubov, Kevin Percy, Mathew May, Mihail Geshoski, Shamim Rezaie, Amaia Anabitarte, Bas Brands, Carlos Escobedo, Laurent David, Raquel Ortega, Sabina Abellan, Sara Arjona (@sarjona), Dan Marsden, Amaia Anabitarte, Bas Brands, Carlos Escobedo, Laurent David, Raquel Ortega, Sabina Abellan, Sara Arjona (@sarjona), Jean-Philippe Gaudreau, Steve Massicotte, Serge Gauthier, Issam Taboubi, Ilya Tregubov, Kevin Percy, Mathew May, Mihail Geshoski, Shamim Rezaie, Amaia Anabitarte, Bas Brands, Carlos Escobedo, Laurent David, Raquel Ortega, Sabina Abellan, Sara Arjona (@sarjona), Amaia Anabitarte, Bas Brands, Carlos Escobedo, Laurent David, Raquel Ortega, Sabina Abellan, Sara Arjona (@sarjona), Adrian Greeve, Ilya Tregubov, Kevin Percy, Mathew May, Mihail Geshoski, Shamim Rezaie, Adrian Greeve, David Woloszyn, Huong Nguyen, Jake Dallimore, Michael Hawkins, Stevani Andolo, Ilya Tregubov, Kevin Percy, Mathew May, Mihail Geshoski, Shamim Rezaie, Adrian Greeve, Ilya Tregubov, Kevin Percy, Mathew May, Mihail Geshoski, Shamim Rezaie, Ilya Tregubov, Kevin Percy, Mathew May, Mihail Geshoski, Shamim Rezaie, David Woloszyn, Huong Nguyen, Jake Dallimore, Michael Hawkins, Stevani Andolo, Tim Hunt, Amaia Anabitarte, Bas Brands, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Kevin Percy, Laurent David, Mathew May, Mihail Geshoski, Raquel Ortega, Sabina Abellan, Sander Bangma, Sara Arjona (@sarjona), Shamim Rezaie, Dan Marsden, Matteo Scaramuccia, Ilya Tregubov, Kevin Percy, Mathew May, Mihail Geshoski, Shamim Rezaie, Amaia Anabitarte, Bas Brands, Carlos Escobedo, Laurent David, Raquel Ortega, Sabina Abellan, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                3/Dec/18