Moodle
  1. Moodle
  2. MDL-30655

Moving a block to top can cause warning

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Trivial Trivial
    • Resolution: Fixed
    • Affects Version/s: 2.1.3, 2.2, 2.3
    • Fix Version/s: 2.1.4, 2.2.1
    • Component/s: Blocks
    • Labels:
    • Testing Instructions:
      Hide

      EASY

      (Must use a server with debug level set to a suitable value, such as DEVELOPER.)

      0. Go to any course page with more than one block in a column. Turn editing on.
      1. Edit the top block. Set the 'Weight on this page' option to -10.
      2. Move any other block by clicking on the 'move' arrows, then clicking in the marked space above the top block.

      Expected result: Block moves into position without error.
      Actual result: You get the PHP warnings quoted in description.

      Show
      EASY (Must use a server with debug level set to a suitable value, such as DEVELOPER.) 0. Go to any course page with more than one block in a column. Turn editing on. 1. Edit the top block. Set the 'Weight on this page' option to -10. 2. Move any other block by clicking on the 'move' arrows, then clicking in the marked space above the top block. Expected result: Block moves into position without error. Actual result: You get the PHP warnings quoted in description.
    • Affected Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE, MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE
    • Pull Master Branch:
      MDL-30655-master
    • Rank:
      33472

      Description

      If you move a block to the top of the page, when the CURRENT block at top of page has weight -10, this causes PHP warnings:

      Notice: Undefined offset: -11 in /html/lib/blocklib.php on line 1470
      Warning: Invalid argument supplied for foreach() in /html/lib/blocklib.php on line 1470

      This is a trivial problem because the block does move into position correctly once you click Continue.

        Activity

        Hide
        Sam Marshall added a comment -

        This is a pretty harmless bug, and to be honest I don't care too much if/when it's fixed, but our testers found it and I figured if I don't fix it, nobody will!

        Show
        Sam Marshall added a comment - This is a pretty harmless bug, and to be honest I don't care too much if/when it's fixed, but our testers found it and I figured if I don't fix it, nobody will!
        Hide
        Sam Marshall added a comment -

        Also note: if anyone's wondering, I did check and weights less than -10 are already handled correctly in the block settings edit form (if you are editing a block with weight -11 or -12 it adds that option to the dropdown automatically) so there is no need for a change there.

        Show
        Sam Marshall added a comment - Also note: if anyone's wondering, I did check and weights less than -10 are already handled correctly in the block settings edit form (if you are editing a block with weight -11 or -12 it adds that option to the dropdown automatically) so there is no need for a change there.
        Hide
        Eloy Lafuente (stronk7) added a comment -

        The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

        TIA and ciao

        Show
        Eloy Lafuente (stronk7) added a comment - The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week. TIA and ciao
        Hide
        Sam Marshall added a comment -

        Rebased both branches

        Show
        Sam Marshall added a comment - Rebased both branches
        Hide
        Aparup Banerjee added a comment -

        Thanks samM ,thats integrated. I've also picked this into 2.1.x .

        Show
        Aparup Banerjee added a comment - Thanks samM ,thats integrated. I've also picked this into 2.1.x .
        Hide
        Ankit Agarwal added a comment -

        Working great
        Passing!
        Thanks

        Show
        Ankit Agarwal added a comment - Working great Passing! Thanks
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Whoever decided one week was worth 14 days had really one bad idea. Anyway, the nightmare is over, so thanks for your, once again, amazing contributions. Many, many thanks!

        Now... disconnect, relax and enjoy the next days, yay!

        Closing...ciao

        Show
        Eloy Lafuente (stronk7) added a comment - Whoever decided one week was worth 14 days had really one bad idea. Anyway, the nightmare is over, so thanks for your, once again, amazing contributions. Many, many thanks! Now... disconnect, relax and enjoy the next days, yay! Closing...ciao

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: