XF 2.3 Error after upgrading from 2.2.17 to 2.3.4

Itworx4me

Well-known member
I get this error after upgrading from 2.2.17 to 2.3.4. Error happens about every 6 minutes or so.
Code:
ArgumentCountError: Too few arguments to function Less_Functions::hsl(), 1 passed in /home/nginx/domains/nitromater.com/public/src/vendor/oyejorge/less.php/lib/Less/Tree/Call.php on line 76 and exactly 3 expected src/vendor/oyejorge/less.php/lib/Less/Functions.php:84
Generated by: Unknown account Jan 28, 2025 at 7:08 AM
Stack trace
#0 src/vendor/oyejorge/less.php/lib/Less/Tree/Call.php(76): Less_Functions->hsl(Object(Less_Tree_Call))
#1 src/vendor/oyejorge/less.php/lib/Less/Tree/Expression.php(36): Less_Tree_Call->compile(Object(Less_Environment))
#2 src/vendor/oyejorge/less.php/lib/Less/Tree/Value.php(25): Less_Tree_Expression->compile(Object(Less_Environment))
#3 src/vendor/oyejorge/less.php/lib/Less/Tree/Rule.php(76): Less_Tree_Value->compile(Object(Less_Environment))
#4 src/vendor/oyejorge/less.php/lib/Less/Tree/Ruleset.php(95): Less_Tree_Rule->compile(Object(Less_Environment))
#5 src/vendor/oyejorge/less.php/lib/Less/Tree/Ruleset.php(95): Less_Tree_Ruleset->compile(Object(Less_Environment))
#6 src/vendor/oyejorge/less.php/lib/Less/Parser.php(181): Less_Tree_Ruleset->compile(Object(Less_Environment))
#7 src/XF/CssRenderer.php(431): Less_Parser->getCss()
#8 src/XF/CssRenderer.php(371): XF\CssRenderer->renderToCss('public:extra.le...', '// Note that th...')
#9 src/XF/CssRenderer.php(279): XF\CssRenderer->renderTemplate('public:extra.le...', NULL)
#10 src/XF/CssRenderer.php(135): XF\CssRenderer->renderTemplates(Array, Array, Array)
#11 src/XF/CssWriter.php(60): XF\CssRenderer->render(Array)
#12 src/addons/SV/RedisCache/XF/CssWriter.php(68): XF\CssWriter->run(Array, 21, 1, '6e3d3362df87bb4...')
#13 css.php(32): SV\RedisCache\XF\CssWriter->run(Array, 21, 1, '6e3d3362df87bb4...')
#14 {main}
Request state
array(4) {
  ["url"] => string(97) "/css.php?css=public%3Aextra.less&s=21&l=1&d=1738039475&k=6e3d3362df87bb45d4591b57ac6230970f23e687"
  ["referrer"] => string(74) "https://nitromater.com/threads/sunday-will-never-be-the-same.44918/page-17"
  ["_GET"] => array(5) {
    ["css"] => string(17) "public:extra.less"
    ["s"] => string(2) "21"
    ["l"] => string(1) "1"
    ["d"] => string(10) "1738039475"
    ["k"] => string(40) "6e3d3362df87bb45d4591b57ac6230970f23e687"
  }
  ["_POST"] => array(0) {
  }
}

Has anyone encounter this error and what was causing it?

Thanks,
Itworx4me
 
Something in the extra.less template of your style.
Code:
{{ include('xenfocus_base.less') }}
{{ include('xenfocus_theme.less') }}

/* Place your custom code below */
This is the only thing in the extra.less template. It was there in 2.2.17 and I did a fresh install of the 2.3.4 skin for v2.3.4. Is the code different in 2.3.4 to call another template?
Thanks
Itworx4me
 
I have 100's of theses errors. Some show more and some show less templates as being the culprit.

Code:
/src/vendor/oyejorge/less.php/lib/Less/Tree/Call.php on line 76 and exactly 3 expected src/vendor/oyejorge/less.php/lib/Less/Functions.php:84
Generated by: Unknown account Jan 28, 2025 at 4:23 PM
Stack trace
#0 src/vendor/oyejorge/less.php/lib/Less/Tree/Call.php(76): Less_Functions->hsl(Object(Less_Tree_Call))
#1 src/vendor/oyejorge/less.php/lib/Less/Tree/Expression.php(36): Less_Tree_Call->compile(Object(Less_Environment))
#2 src/vendor/oyejorge/less.php/lib/Less/Tree/Value.php(25): Less_Tree_Expression->compile(Object(Less_Environment))
#3 src/vendor/oyejorge/less.php/lib/Less/Tree/Rule.php(76): Less_Tree_Value->compile(Object(Less_Environment))
#4 src/vendor/oyejorge/less.php/lib/Less/Tree/Ruleset.php(95): Less_Tree_Rule->compile(Object(Less_Environment))
#5 src/vendor/oyejorge/less.php/lib/Less/Tree/Ruleset.php(95): Less_Tree_Ruleset->compile(Object(Less_Environment))
#6 src/vendor/oyejorge/less.php/lib/Less/Parser.php(181): Less_Tree_Ruleset->compile(Object(Less_Environment))
#7 src/XF/CssRenderer.php(431): Less_Parser->getCss()
#8 src/XF/CssRenderer.php(371): XF\CssRenderer->renderToCss('public:extra.le...', '// Note that th...')
#9 src/XF/CssRenderer.php(279): XF\CssRenderer->renderTemplate('public:extra.le...', NULL)
#10 src/XF/CssRenderer.php(135): XF\CssRenderer->renderTemplates(Array, Array, Array)
#11 src/XF/CssWriter.php(60): XF\CssRenderer->render(Array)
#12 src/addons/SV/RedisCache/XF/CssWriter.php(68): XF\CssWriter->run(Array, 18, 1, 'f7451e4fe667a28...')
#13 css.php(32): SV\RedisCache\XF\CssWriter->run(Array, 18, 1, 'f7451e4fe667a28...')
#14 {main}
Request state
array(4) {
  ["url"] => string(264) "/css.php?css=public%3Aalnb_navigation.less%2Cpublic%3Abb_code.less%2Cpublic%3Amessage.less%2Cpublic%3Anotices.less%2Cpublic%3Ashare_controls.less%2Cpublic%3Astructured_list.less%2Cpublic%3Aextra.less&s=18&l=1&d=1736825547&k=f7451e4fe667a28a7f1baebd223f5bb37eeca5d4"
  ["referrer"] => bool(false)
  ["_GET"] => array(5) {
    ["css"] => string(160) "public:alnb_navigation.less,public:bb_code.less,public:message.less,public:notices.less,public:share_controls.less,public:structured_list.less,public:extra.less"
    ["s"] => string(2) "18"
    ["l"] => string(1) "1"
    ["d"] => string(10) "1736825547"
    ["k"] => string(40) "f7451e4fe667a28a7f1baebd223f5bb37eeca5d4"
  }
  ["_POST"] => array(0) {
  }
}
 
Code:
src/vendor/oyejorge/less.php/lib/Less/Tree/Call.php on line 76 and exactly 3 expected src/vendor/oyejorge/less.php/lib/Less/Functions.php:84
Generated by: Unknown account Jan 28, 2025 at 3:53 PM
Stack trace
#0 src/vendor/oyejorge/less.php/lib/Less/Tree/Call.php(76): Less_Functions->hsl(Object(Less_Tree_Call))
#1 src/vendor/oyejorge/less.php/lib/Less/Tree/Expression.php(36): Less_Tree_Call->compile(Object(Less_Environment))
#2 src/vendor/oyejorge/less.php/lib/Less/Tree/Value.php(25): Less_Tree_Expression->compile(Object(Less_Environment))
#3 src/vendor/oyejorge/less.php/lib/Less/Tree/Rule.php(76): Less_Tree_Value->compile(Object(Less_Environment))
#4 src/vendor/oyejorge/less.php/lib/Less/Tree/Ruleset.php(95): Less_Tree_Rule->compile(Object(Less_Environment))
#5 src/vendor/oyejorge/less.php/lib/Less/Tree/Ruleset.php(95): Less_Tree_Ruleset->compile(Object(Less_Environment))
#6 src/vendor/oyejorge/less.php/lib/Less/Parser.php(181): Less_Tree_Ruleset->compile(Object(Less_Environment))
#7 src/XF/CssRenderer.php(431): Less_Parser->getCss()
#8 src/XF/CssRenderer.php(371): XF\CssRenderer->renderToCss('public:extra.le...', '// Note that th...')
#9 src/XF/CssRenderer.php(279): XF\CssRenderer->renderTemplate('public:extra.le...', NULL)
#10 src/XF/CssRenderer.php(135): XF\CssRenderer->renderTemplates(Array, Array, Array)
#11 src/XF/CssWriter.php(60): XF\CssRenderer->render(Array)
#12 src/addons/SV/RedisCache/XF/CssWriter.php(68): XF\CssWriter->run(Array, 18, 1, 'cb5049de9b19117...')
#13 css.php(32): SV\RedisCache\XF\CssWriter->run(Array, 18, 1, 'cb5049de9b19117...')
#14 {main}
Request state
array(4) {
  ["url"] => string(289) "/css.php?css=public%3Aalnb_navigation.less%2Cpublic%3Abb_code.less%2Cpublic%3Alightbox.less%2Cpublic%3Amessage.less%2Cpublic%3Anotices.less%2Cpublic%3Ashare_controls.less%2Cpublic%3Astructured_list.less%2Cpublic%3Aextra.less&s=18&l=1&d=1737951210&k=cb5049de9b191179332dc3f93748be3939bf7d8d"
  ["referrer"] => string(102) "https://nitromater.com/threads/so-the-nhra-decides-to-cave-and-screw-over-a-popular-driver-over.49888/"
  ["_GET"] => array(5) {
    ["css"] => string(181) "public:alnb_navigation.less,public:bb_code.less,public:lightbox.less,public:message.less,public:notices.less,public:share_controls.less,public:structured_list.less,public:extra.less"
    ["s"] => string(2) "18"
    ["l"] => string(1) "1"
    ["d"] => string(10) "1737951210"
    ["k"] => string(40) "cb5049de9b191179332dc3f93748be3939bf7d8d"
  }
  ["_POST"] => array(0) {
  }
}
 
I ended up deleting the custom style and starting over with it. Seems the errors have went away. Not sure what happened because I install the new version for 2.3.4. But left the legacy style in place but not active. Thanks to all that tried to help.

Itworx4me
 
I have same issue, for me this causes 500 internal server error on the CSS.
Had to disable Style Suite add-on to bring the site up. Any help is appreciated.

Code:
ArgumentCountError: Too few arguments to function Less_Functions::hsla(), 3 passed in /src/vendor/oyejorge/less.php/lib/Less/Tree/Call.php on line 76 and exactly 4 expected src/vendor/oyejorge/less.php/lib/Less/Functions.php:88
Generated by: Unknown account Feb 20, 2025 at 9:57 AM
Stack trace
#0 src/vendor/oyejorge/less.php/lib/Less/Tree/Call.php(76): Less_Functions->hsla(Object(Less_Tree_Dimension), Object(Less_Tree_Dimension), Object(Less_Tree_Dimension))
#1 src/vendor/oyejorge/less.php/lib/Less/Tree/Expression.php(46): Less_Tree_Call->compile(Object(Less_Environment))
#2 src/vendor/oyejorge/less.php/lib/Less/Tree/Value.php(25): Less_Tree_Expression->compile(Object(Less_Environment))
#3 src/vendor/oyejorge/less.php/lib/Less/Tree/Rule.php(76): Less_Tree_Value->compile(Object(Less_Environment))
#4 src/vendor/oyejorge/less.php/lib/Less/Tree/Ruleset.php(95): Less_Tree_Rule->compile(Object(Less_Environment))
#5 src/vendor/oyejorge/less.php/lib/Less/Tree/Ruleset.php(95): Less_Tree_Ruleset->compile(Object(Less_Environment))
#6 src/vendor/oyejorge/less.php/lib/Less/Parser.php(181): Less_Tree_Ruleset->compile(Object(Less_Environment))
#7 src/XF/CssRenderer.php(431): Less_Parser->getCss()
#8 src/XF/CssRenderer.php(371): XF\CssRenderer->renderToCss('public:app.less', '// Note that th...')
#9 src/XF/CssRenderer.php(279): XF\CssRenderer->renderTemplate('public:app.less', NULL)
#10 src/XF/CssRenderer.php(135): XF\CssRenderer->renderTemplates(Array, Array, Array)
#11 src/XF/CssWriter.php(60): XF\CssRenderer->render(Array)
#12 src/addons/SV/RedisCache/XF/CssWriter.php(68): XF\CssWriter->run(Array, 1, 1, '3a904a66962d28b...')
#13 css.php(32): SV\RedisCache\XF\CssWriter->run(Array, 1, 1, '3a904a66962d28b...')
#14 {main}
Request state
array(4) {
  ["url"] => string(185) "/css.php?css=public%3Anormalize.css%2Cpublic%3Afa.css%2Cpublic%3Avariations.less%2Cpublic%3Acore.less%2Cpublic%3Aapp.less&s=1&l=1&d=1740043516&k=3a904a66962d28b6fc17a7b220d97f517cd69dbe"
  ["referrer"] => string(173) ""
  ["_GET"] => array(5) {
    ["css"] => string(90) "public:normalize.css,public:fa.css,public:variations.less,public:core.less,public:app.less"
    ["s"] => string(1) "1"
    ["l"] => string(1) "1"
    ["d"] => string(10) "1740043516"
    ["k"] => string(40) "3a904a66962d28b6fc17a7b220d97f517cd69dbe"
  }
  ["_POST"] => array(0) {
  }
}
 
Try to clear every CSS from extra.less or any custom style if error is gone and you have to re-written new custom CSS again
The issue is the color picker for me.

The plugin Style Suite let users use the color picker to change their username color.
But the color picker doesn't properly validate user input.
A user changed:
CSS:
hsl(264, 94%, 66%)
To:
CSS:
hsla(264, 94%, 66%)

hsla takes 4 values not 3.
Because of this the site CSS gives 500 Internal Server Error. and renders the site unusable.

Untitled.webp


@Itworx4me what add-ons do you have installed? Specially those who deal with colors.
 
The issue is the color picker for me.

The plugin Style Suite let users use the color picker to change their username color.
But the color picker doesn't properly validate user input.
A user changed:
CSS:
hsl(264, 94%, 66%)
To:
CSS:
hsla(264, 94%, 66%)

hsla takes 4 values not 3.
Because of this the site CSS gives 500 Internal Server Error. and renders the site unusable.

View attachment 319287


@Itworx4me what add-ons do you have installed? Specially those who deal with colors.
Why not just use a hex value for the colour instead?
 
Why not just use a hex value for the colour instead?
Fine by me. Whatever works!
If hex is easier to validate then XF staff should modify the color picker use hex instead of hsl(a).

color-picker.webp


All takes to break a site is enter something like
Code:
hsla(35, 85%, 35%)
in text color there.

An admin wouldn't do it on purpose but a user can't be trusted. the picker isn't safe.
 
Last edited:
This enforces 3 values and 2 commas for rgb/hsl and
also enforced 4 values and 3 commas for rgba/hsla

PHP:
    public static function isValidColor($color)
{
    if (array_key_exists(Str::strtolower($color), static::$namedColors)) {
        return true;
    }

    if ($color && $color[0] === "#") {
        $color = substr($color, 1);
        return in_array(strlen($color), [3, 4, 6, 8]) && ctype_xdigit($color);
    } elseif (preg_match("/^(rgba|hsla)\(\s*(\d+%?(deg|rad|grad|turn)?\s*,\s*){3}\s*[\d\.]+%?\s*\)$/i", $color)) {
        // Check for rgba or hsla with exactly four values and three commas
        return true;
    } else {
        // Check for rgb or hsl with exactly three values and two commas
        return preg_match("/^(rgb|hsl)\(\s*(\d+%?(deg|rad|grad|turn)?\s*,\s*){2}\s*[\d\.]+%?\s*\)$/i", $color);
    }
}
 
i get this error as well. it's stemming from trying to use hsla in a less file, and it's not getting parsed correctly

CSS:
color: hsla(var(--xf-textColorAttention))

if you wrap the css in quotes with tilde in front it wont be parsed and will pass through to the browser correctly

CSS:
color: ~"hsla(var(--xf-textColorAttention))"
 
Last edited:
I ended up deleting the custom style and starting over with it. Seems the errors have went away. Not sure what happened because I install the new version for 2.3.4. But left the legacy style in place but not active. Thanks to all that tried to help.

Itworx4me

Ehren does state that the old style needs removing first before installing the new one. The only thing I'd recommend doing is making a backup of of any changes you've made to the default style as you will need to reapply them
 
Back
Top Bottom