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

No 'fontsize' setting in Boost causes unit conflict

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.7.7, 3.8.4, 3.9.1, 3.10, 4.0
    • Fix Version/s: 3.8.5, 3.9.2
    • Component/s: Themes
    • Labels:
    • Testing Instructions:
      Hide
      1. Download and extract moo.zip.
      2. Open and follow the instructions contained in the Readme.md file to install the theme.
      3. Leave the default 'fontsize' setting value at '90%' when installing.
      4. Select the theme from within the UI.
      5. Purge all caches.
      6. Observe that no 'A non well formed numeric value encountered' error is in the PHP error log.
      Show
      Download and extract moo.zip. Open and follow the instructions contained in the Readme.md file to install the theme. Leave the default 'fontsize' setting value at '90%' when installing. Select the theme from within the UI. Purge all caches. Observe that no 'A non well formed numeric value encountered' error is in the PHP error log.
    • Workaround:
      Hide

      Don't use the setting name 'fontsize' in a child theme or ensure it is an integer with the description stating that it is in 'rem' units.

      Show
      Don't use the setting name 'fontsize' in a child theme or ensure it is an integer with the description stating that it is in 'rem' units.
    • Affected Branches:
      MOODLE_310_STABLE, MOODLE_37_STABLE, MOODLE_38_STABLE, MOODLE_39_STABLE, MOODLE_400_STABLE
    • Fixed Branches:
      MOODLE_38_STABLE, MOODLE_39_STABLE
    • Pull from Repository:
    • Pull 3.9 Branch:
      wip_MDL-69491_m39
    • Pull 3.10 Branch:
      wip_MDL-69491_m310
    • Pull Master Branch:
      wip_MDL-69491_master

      Description

      In 'theme_boost_get_pre_scss' there is the code:

      $scss .= '$font-size-base: ' . (1 / 100 * $theme->settings->fontsize) . "rem !default;\n";

      which assumes that the 'fontsize' setting is in 'rem' units.  However:

      1. If a theme declares a setting of the same name (in effect to override the setting) with a non-numeric value then the error 'A non well formed numeric value encountered' happens when 'Purge all caches'.  This is because of the way that 'get_pre_scss_code' works in 'outputlib.php' and the child theme theme_config instance (referenced by $theme) is used with the Boost code 'theme_boost_get_pre_scss'.
      2. Boost has no 'fontsize' setting delaired in its 'settings.php'!

      Therefore this code is redundant and I propose it should be removed = its a bug!

      Code's been there since MDL-56511 with the string:

      $string['fontsize_desc'] = 'Enter a fontsize in %';

      stating percent and yet the code is 'rem'!  Thus a bug in MDL-56511.

       

       

        Attachments

        1. MDL-69491.jpg
          MDL-69491.jpg
          15 kB
        2. moo.zip
          19 kB

          Issue Links

            Activity

              People

              Assignee:
              gb2048 Gareth J Barnard
              Reporter:
              gb2048 Gareth J Barnard
              Peer reviewer:
              Bas Brands Bas Brands
              Integrator:
              Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
              Tester:
              Anna Carissa Sadia Anna Carissa Sadia
              Participants:
              Component watchers:
              Huong Nguyen, Bas Brands, Mathew May
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                14/Sep/20

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 hour, 35 minutes
                  1h 35m