Skip to content

Error accessing the forum after saving custom CSS with more than +68000 characters #3081

@iamdarkle

Description

@iamdarkle

Bug Report

Current Behavior
Error when accessing the forum after saving in the admin panel a custom CSS code of +68000 characters (doesn't mean it's exactly that number, in my case I've experienced it when reaching that number of characters).

This causes that when saving the CSS code the last lines are cut, and therefore in my case for example this caused a ParseError: missing closing'}' error in the entire forum because it just cut the code before a }

Steps to Reproduce

  1. Go to admin panel ->Appearance -> Edit custom CSS
  2. Paste the CSS code
  3. Save (no error will appear)
    After this if you reopen the Edit Custom CSS box you will see the cut code
  4. Go to the forum and you will see an error (depending on where the CSS code is cut) or lack of changes

Expected Behavior
Avoid cutting the CSS code when it has ±68000 characters through the admin panel.

Environment

  • Flarum version: 1.0.4

Possible Solution (by @clarkwinkelmann)

We have a step to validate the Less but the code probably gets truncated when inserted in the database, so the validation won't catch it https://github.com/flarum/core/blob/master/src/Forum/ValidateCustomLess.php

We should probably add max length validation for all settings. This probably has never been an issue in the past because most settings are short strings and there was never any risk of reaching the TEXT limitation.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions