XF 2.2 Might be a bug - empty Style Property

beerForo

Well-known member
I was changing "Highlighted content background color" in a child style.
I somehow left it empty and Saved.
It screwed up the whole site, just a white site with no css. Even acp was messed up and had an OOPS message but I don't remember it, something about, .less function can only be done by POST or something. A lot of the acp was missing but I made it to styles and saw the empty value for "Highlighted content background color." I entered one, Saved, and fixed the issue, site back.

Just to make sure that was it I repeated it and it happened again. Is that a bug? I wasn't even sure what happened at first thought it was some cache or rebuild issue. Seems that should not happen.

EDIT: I still had the tab open from where it tried to save and I did not leave it empty I had "@xf-majorHeadingBg" there but to the right, there is the question mark. So somehow it saved empty. For testing, leave it empty and you will see it happen.
 
Last edited:
Code:
[LIST]
[*]XF\CssRenderException: Error rendering template public:app.less: Expected ')' got ',' in public:app.less (on or near line 5299)
[*]src/XF/CssRenderException.php:89
[*]Generated by: Unknown account
[*]Sep 16, 2021 at 1:45 PM
[/LIST]
[HEADING=2]Stack trace[/HEADING]
 5296 |     &.userBanner--staff,
 5297 |     &.userBanner--primary
 5298 |     {
[I]5299[/I]|         .m-userBannerVariation(rgb(234, 230, 228), , rgb(182, 39, 48));
 5300 |     }
 5301 |
 5302 |     &.userBanner--accent
------------

#0 src/XF/CssRenderer.php(418): XF\CssRenderException::createFromLessException(Object(Less_Exception_Parser), 'public:app.less', '// Note that th...')
#1 src/XF/CssRenderer.php(352): XF\CssRenderer->renderToCss('public:app.less', '// Note that th...')
#2 src/XF/CssRenderer.php(260): XF\CssRenderer->renderTemplate('public:app.less', NULL)
#3 src/XF/CssRenderer.php(118): XF\CssRenderer->renderTemplates(Array, Array, Array)
#4 src/XF/CssWriter.php(55): XF\CssRenderer->render(Array)
#5 css.php(30): XF\CssWriter->run(Array, 3, 1, '1960543b3175d1a...')
#6 {main}

-------------

Previous Less_Exception_Parser: Expected ')' got ',' in anonymous-file-1469.less - src/vendor/oyejorge/less.php/lib/Less/Parser.php:2795
#0 src/vendor/oyejorge/less.php/lib/Less/Parser.php(942): Less_Parser->Error('Expected ')' go...')
#1 src/vendor/oyejorge/less.php/lib/Less/Parser.php(1489): Less_Parser->expectChar(')')
#2 src/vendor/oyejorge/less.php/lib/Less/Parser.php(858): Less_Parser->parseMixinCall()
#3 src/vendor/oyejorge/less.php/lib/Less/Parser.php(1009): Less_Parser->MatchFuncs(Array)
#4 src/vendor/oyejorge/less.php/lib/Less/Parser.php(1938): Less_Parser->parsePrimary()
#5 src/vendor/oyejorge/less.php/lib/Less/Parser.php(1993): Less_Parser->parseBlock()
#6 src/vendor/oyejorge/less.php/lib/Less/Parser.php(858): Less_Parser->parseRuleset()
#7 src/vendor/oyejorge/less.php/lib/Less/Parser.php(1009): Less_Parser->MatchFuncs(Array)
#8 src/vendor/oyejorge/less.php/lib/Less/Parser.php(1938): Less_Parser->parsePrimary()
#9 src/vendor/oyejorge/less.php/lib/Less/Parser.php(1993): Less_Parser->parseBlock()
#10 src/vendor/oyejorge/less.php/lib/Less/Parser.php(858): Less_Parser->parseRuleset()
#11 src/vendor/oyejorge/less.php/lib/Less/Parser.php(1009): Less_Parser->MatchFuncs(Array)
#12 src/vendor/oyejorge/less.php/lib/Less/Parser.php(674): Less_Parser->parsePrimary()
#13 src/vendor/oyejorge/less.php/lib/Less/Parser.php(621): Less_Parser->GetRules(NULL)
#14 src/vendor/oyejorge/less.php/lib/Less/Parser.php(449): Less_Parser->_parse()
#15 src/XF/CssRenderer.php(414): Less_Parser->parse('// Note that th...')
#16 src/XF/CssRenderer.php(352): XF\CssRenderer->renderToCss('public:app.less', '// Note that th...')
#17 src/XF/CssRenderer.php(260): XF\CssRenderer->renderTemplate('public:app.less', NULL)
#18 src/XF/CssRenderer.php(118): XF\CssRenderer->renderTemplates(Array, Array, Array)
#19 src/XF/CssWriter.php(55): XF\CssRenderer->render(Array)
#20 css.php(30): XF\CssWriter->run(Array, 3, 1, '1960543b3175d1a...')
#21 {main}
[HEADING=2]Request state[/HEADING]
array(4) {
  ["url"] => string(158) "/css.php?css=public%3Anormalize.css%2Cpublic%3Afa.css%2Cpublic%3Acore.less%2Cpublic%3Aapp.less&s=3&l=1&d=1631814322&k=1960543b3175d1a54164bf81cc4125933e029c27"
  ["referrer"] => string(25) "https://*****.com/"
  ["_GET"] => array(5) {
    ["css"] => string(67) "public:normalize.css,public:fa.css,public:core.less,public:app.less"
    ["s"] => string(1) "3"
    ["l"] => string(1) "1"
    ["d"] => string(10) "1631814322"
    ["k"] => string(40) "1960543b3175d1a54164bf81cc4125933e029c27"
  }
  ["_POST"] => array(0) {
  }
}
 
Last edited:
You typically can't just delete values like that. A lot of time XF will call upon style properties in various places. That highlight color is used a lot through the less(css) templates
 
2 errors below from that test with it fileld in
Code:
XF\CssRenderException: Error rendering template public:core.less: ParseError: Unexpected input in public:core.less on line 11181, column 17 (on or near line 11181)
src/XF/CssRenderException.php:89
Generated by: Unknown account
Sep 16, 2021 at 2:28 PM


Stack trace
11178 |
11179 | .pageNavWrapper {}
11180 |
*11181*| .m-pageNavElCore()
11182 | {
11183 |     background: linear-gradient(0deg, , mix(, rgb(68, 10, 10), 25%));
11184 |     color: rgb(234, 230, 228);
------------

#0 src/XF/CssRenderer.php(418): XF\CssRenderException::createFromLessException(Object(Less_Exception_Chunk), 'public:core.les...', '// Note that th...')
#1 src/XF/CssRenderer.php(352): XF\CssRenderer->renderToCss('public:core.les...', '// Note that th...')
#2 src/XF/CssRenderer.php(260): XF\CssRenderer->renderTemplate('public:core.les...', NULL)
#3 src/XF/CssRenderer.php(118): XF\CssRenderer->renderTemplates(Array, Array, Array)
#4 src/XF/CssWriter.php(55): XF\CssRenderer->render(Array)
#5 css.php(30): XF\CssWriter->run(Array, 3, 1, '1960543b3175d1a...')
#6 {main}

-------------

Previous Less_Exception_Chunk: ParseError: Unexpected input in anonymous-file-0.less on line 11181, column 17
11179| .pageNavWrapper {}
11180|
11181| .m-pageNavElCore()
11182| {
11183|     background: linear-gradient(0deg, , mix(, rgb(68, 10, 10), 25%));
11184|     color: rgb(234, 230, 228); - src/vendor/oyejorge/less.php/lib/Less/Parser.php:677
#0 src/vendor/oyejorge/less.php/lib/Less/Parser.php(621): Less_Parser->GetRules(NULL)
#1 src/vendor/oyejorge/less.php/lib/Less/Parser.php(449): Less_Parser->_parse()
#2 src/XF/CssRenderer.php(414): Less_Parser->parse('// Note that th...')
#3 src/XF/CssRenderer.php(352): XF\CssRenderer->renderToCss('public:core.les...', '// Note that th...')
#4 src/XF/CssRenderer.php(260): XF\CssRenderer->renderTemplate('public:core.les...', NULL)
#5 src/XF/CssRenderer.php(118): XF\CssRenderer->renderTemplates(Array, Array, Array)
#6 src/XF/CssWriter.php(55): XF\CssRenderer->render(Array)
#7 css.php(30): XF\CssWriter->run(Array, 3, 1, '1960543b3175d1a...')
#8 {main}
Request state
array(4) {
["url"] => string(158) "/css.php?css=public%3Anormalize.css%2Cpublic%3Afa.css%2Cpublic%3Acore.less%2Cpublic%3Aapp.less&s=3&l=1&d=1631816888&k=1960543b3175d1a54164bf81cc4125933e029c27"
["referrer"] => string(25) "https://*****com/"
["_GET"] => array(5) {
["css"] => string(67) "public:normalize.css,public:fa.css,public:core.less,public:app.less"
["s"] => string(1) "3"
["l"] => string(1) "1"
["d"] => string(10) "1631816888"
["k"] => string(40) "1960543b3175d1a54164bf81cc4125933e029c27"
}
["_POST"] => array(0) {
}
}





XF\CssRenderException: Error rendering template public:app.less: Expected ')' got ',' in public:app.less (on or near line 5299)
src/XF/CssRenderException.php:89
Generated by: Unknown account
Sep 16, 2021 at 2:28 PM


Stack trace
5296 |     &.userBanner--staff,
5297 |     &.userBanner--primary
5298 |     {
*5299*|         .m-userBannerVariation(rgb(234, 230, 228), , rgb(182, 39, 48));
5300 |     }
5301 |
5302 |     &.userBanner--accent
------------

#0 src/XF/CssRenderer.php(418): XF\CssRenderException::createFromLessException(Object(Less_Exception_Parser), 'public:app.less', '// Note that th...')
#1 src/XF/CssRenderer.php(352): XF\CssRenderer->renderToCss('public:app.less', '// Note that th...')
#2 src/XF/CssRenderer.php(260): XF\CssRenderer->renderTemplate('public:app.less', NULL)
#3 src/XF/CssRenderer.php(118): XF\CssRenderer->renderTemplates(Array, Array, Array)
#4 src/XF/CssWriter.php(55): XF\CssRenderer->render(Array)
#5 css.php(30): XF\CssWriter->run(Array, 3, 1, '1960543b3175d1a...')
#6 {main}

-------------

Previous Less_Exception_Parser: Expected ')' got ',' in anonymous-file-1469.less - src/vendor/oyejorge/less.php/lib/Less/Parser.php:2795
#0 src/vendor/oyejorge/less.php/lib/Less/Parser.php(942): Less_Parser->Error('Expected ')' go...')
#1 src/vendor/oyejorge/less.php/lib/Less/Parser.php(1489): Less_Parser->expectChar(')')
#2 src/vendor/oyejorge/less.php/lib/Less/Parser.php(858): Less_Parser->parseMixinCall()
#3 src/vendor/oyejorge/less.php/lib/Less/Parser.php(1009): Less_Parser->MatchFuncs(Array)
#4 src/vendor/oyejorge/less.php/lib/Less/Parser.php(1938): Less_Parser->parsePrimary()
#5 src/vendor/oyejorge/less.php/lib/Less/Parser.php(1993): Less_Parser->parseBlock()
#6 src/vendor/oyejorge/less.php/lib/Less/Parser.php(858): Less_Parser->parseRuleset()
#7 src/vendor/oyejorge/less.php/lib/Less/Parser.php(1009): Less_Parser->MatchFuncs(Array)
#8 src/vendor/oyejorge/less.php/lib/Less/Parser.php(1938): Less_Parser->parsePrimary()
#9 src/vendor/oyejorge/less.php/lib/Less/Parser.php(1993): Less_Parser->parseBlock()
#10 src/vendor/oyejorge/less.php/lib/Less/Parser.php(858): Less_Parser->parseRuleset()
#11 src/vendor/oyejorge/less.php/lib/Less/Parser.php(1009): Less_Parser->MatchFuncs(Array)
#12 src/vendor/oyejorge/less.php/lib/Less/Parser.php(674): Less_Parser->parsePrimary()
#13 src/vendor/oyejorge/less.php/lib/Less/Parser.php(621): Less_Parser->GetRules(NULL)
#14 src/vendor/oyejorge/less.php/lib/Less/Parser.php(449): Less_Parser->_parse()
#15 src/XF/CssRenderer.php(414): Less_Parser->parse('// Note that th...')
#16 src/XF/CssRenderer.php(352): XF\CssRenderer->renderToCss('public:app.less', '// Note that th...')
#17 src/XF/CssRenderer.php(260): XF\CssRenderer->renderTemplate('public:app.less', NULL)
#18 src/XF/CssRenderer.php(118): XF\CssRenderer->renderTemplates(Array, Array, Array)
#19 src/XF/CssWriter.php(55): XF\CssRenderer->render(Array)
#20 css.php(30): XF\CssWriter->run(Array, 3, 1, '1960543b3175d1a...')
#21 {main}
Request state
array(4) {
["url"] => string(158) "/css.php?css=public%3Anormalize.css%2Cpublic%3Afa.css%2Cpublic%3Acore.less%2Cpublic%3Aapp.less&s=3&l=1&d=1631816888&k=1960543b3175d1a54164bf81cc4125933e029c27"
["referrer"] => string(25) "https://*****.com/"
["_GET"] => array(5) {
["css"] => string(67) "public:normalize.css,public:fa.css,public:core.less,public:app.less"
["s"] => string(1) "3"
["l"] => string(1) "1"
["d"] => string(10) "1631816888"
["k"] => string(40) "1960543b3175d1a54164bf81cc4125933e029c27"
}
["_POST"] => array(0) {
}
}
 
Yes, but check out major heading background. It's calling:

@xf-contentHighlightBg by default. So you're looping the value essentially. Major bg calling highlight, highlight calling major bg with no actual color value set.
 
Editor selection background
Editor selection text color

I've left these two blank because the mouse highlight function reverts to the browser's blue color. Works! The site did not break and cause errors when left blank so I am guessing leaving "Highlighted content background color" left blank and breaking the site is a bug. I will mention @Chris D just in case. Thanks
 
Not sure if they'll declare it a bug but "contentHighlightBg" is used in a lot of places, you can't just leave that value blank. For example, template app_user_banners.less calls this:

Code:
    &.userBanner--staff,
    &.userBanner--primary
    {
        .m-userBannerVariation(@xf-linkColor, @xf-contentHighlightBg, @xf-borderColorHighlight);
    }

Which runs through this:

Code:
.m-userBannerVariation(@color; @bg; @border: false)
{
    color: @color;
    background: @bg;
    border-color: xf-intensify(@bg, 10%);

    & when (iscolor(@border))
    {
        border-color: @border;
    }
}

It's attempting to determine the border by intensifying the @bg (@xf-contentHighlightBg) but it's failing because you're leaving it blank. I'd assume if you were to get rid of any calculations like this that refer to @xf-contentHighlightBg it would load fine (just like your editor selection background).

If you were to add this to your extra.less template:

Code:
.m-editorColors(@color; @bg; @border: false)
{
    color: @color;
    background: @bg;
    border-color: xf-intensify(@bg, 10%);

    & when (iscolor(@border))
    {
        border-color: @border;
    }
}
#XF .fr-box.fr-basic .fr-toolbar.fr-top
{
    .m-editorColors(@xf-linkColor, @xf-editorSelectionBg, @xf-borderColorHighlight);
}

After removing the editorSelectionBg, it would throw a bug as well. This isn't really specific to a certain basic color such as the hightlight bg.
 
Top Bottom