Fixed Object of class Less_Tree_Dimension could not be converted to int

Russ

Well-known member
Affected version
2.3.5
This popped up as of the 2.3.5 update. The only way I can get the error to trigger is essentially switching from the default style to another style. This problem appears in my framework and also just a customized default style.

Thoughts?

Code:
XF\CssRenderException: Error rendering template public:app.less: error evaluating function `clamp` [E_NOTICE] Object of class Less_Tree_Dimension could not be converted to int index: 22274 in public:app.less (on or near line 1)
src/XF/CssRenderException.php:89
Generated by: Unknown account




ErrorException: [E_NOTICE] Object of class Less_Tree_Dimension could not be converted to int src/vendor/oyejorge/less.php/lib/Less/Functions.php:36
Generated by: Unknown account Jan 31, 2025 at 2:56 AM
Stack trace
#0 [internal function]: XF::handlePhpError(8, '[E_NOTICE] Obje...', '/home/pedev/pub...', 36)
#1 src/vendor/oyejorge/less.php/lib/Less/Functions.php(36): max(Object(Less_Tree_Dimension), 0)
#2 src/vendor/oyejorge/less.php/lib/Less/Tree/Call.php(76): Less_Functions::clamp(Object(Less_Tree_Dimension), Object(Less_Tree_Call), Object(Less_Tree_Dimension))
#3 src/vendor/oyejorge/less.php/lib/Less/Tree/Operation.php(26): Less_Tree_Call->compile(Object(Less_Environment))
#4 src/vendor/oyejorge/less.php/lib/Less/Tree/Call.php(40): Less_Tree_Operation->compile(Object(Less_Environment))
#5 src/XF/Less/Tree/HslColor.php(225): Less_Tree_Call->compile(Object(Less_Environment))
#6 [internal function]: XF\Less\Tree\HslColor->XF\Less\Tree\{closure}(Object(Less_Tree_Call))
#7 src/XF/Less/Tree/HslColor.php(217): array_map(Object(Closure), Array)
#8 src/vendor/oyejorge/less.php/lib/Less/Tree/Mixin/Definition.php(110): XF\Less\Tree\HslColor->compile(Object(Less_Environment))
#9 src/vendor/oyejorge/less.php/lib/Less/Tree/Mixin/Definition.php(161): Less_Tree_Mixin_Definition->compileParams(Object(Less_Environment), Array, Array, Array)
#10 src/vendor/oyejorge/less.php/lib/Less/Tree/Mixin/Call.php(127): Less_Tree_Mixin_Definition->evalCall(Object(Less_Environment), Array, NULL)
#11 src/vendor/oyejorge/less.php/lib/Less/Tree/Ruleset.php(147): Less_Tree_Mixin_Call->compile(Object(Less_Environment))
#12 src/vendor/oyejorge/less.php/lib/Less/Tree/Ruleset.php(90): Less_Tree_Ruleset->EvalMixinCalls(Object(Less_Tree_Ruleset), Object(Less_Environment), 1)
#13 src/vendor/oyejorge/less.php/lib/Less/Tree/Ruleset.php(95): Less_Tree_Ruleset->compile(Object(Less_Environment))
#14 src/vendor/oyejorge/less.php/lib/Less/Tree/Ruleset.php(95): Less_Tree_Ruleset->compile(Object(Less_Environment))
#15 src/vendor/oyejorge/less.php/lib/Less/Parser.php(181): Less_Tree_Ruleset->compile(Object(Less_Environment))
#16 src/XF/CssRenderer.php(431): Less_Parser->getCss()
#17 src/XF/CssRenderer.php(371): XF\CssRenderer->renderToCss('public:app.less', '// Note that th...')
#18 src/XF/CssRenderer.php(279): XF\CssRenderer->renderTemplate('public:app.less', NULL)
#19 src/XF/CssRenderer.php(135): XF\CssRenderer->renderTemplates(Array, Array, Array)
#20 src/XF/CssWriter.php(60): XF\CssRenderer->render(Array)
#21 css.php(32): XF\CssWriter->run(Array, 1053, 1, '2bff91ece435f89...')
#22 {main}
Request state
array(4) {
  ["url"] => string(195) "/URL/css.php?css=public%3Anormalize.css%2Cpublic%3Afa.css%2Cpublic%3Avariations.less%2Cpublic%3Acore.less%2Cpublic%3Aapp.less&s=1053&l=1&d=1738251744&k=2bff91ece435f896ae9988a75ebee16a10d02122"
  ["referrer"] => string(29) "URL"
  ["_GET"] => array(5) {
    ["css"] => string(90) "public:normalize.css,public:fa.css,public:variations.less,public:core.less,public:app.less"
    ["s"] => string(4) "1053"
    ["l"] => string(1) "1"
    ["d"] => string(10) "1738251744"
    ["k"] => string(40) "2bff91ece435f896ae9988a75ebee16a10d02122"
  }
  ["_POST"] => array(0) {
  }
}

After switching to the style, I can browse around fine on every page without the error throwing. Only seems to happen when switching to a new style and even then it's random.
We also don't use the clamp function.
 
Last edited:
Update.. it's only on every page if you have debug mode enabled:
Code:
$config['debug'] = true;
$config['development']['enabled'] = true;
 
I was seeing this after an upgrade and I disabled a lot of add-ons and it went away. I haven't re-enabled them one by one to see which add-on is causing it but that's your most likely cause....

Edit: Are you running this modification?

[cXF] Remove Location, Website and About you field​

 
Last edited:
I was seeing this after an upgrade and I disabled a lot of add-ons and it went away. I haven't re-enabled them one by one to see which add-on is causing it but that's your most likely cause....

Edit: Are you running this modification?

[cXF] Remove Location, Website and About you field​

I don't use ANY addons, except the addons I wrote myself. I've disabled all addons, and it still happens. It's particular to a specific skin.
 
I don't use ANY addons, except the addons I wrote myself. I've disabled all addons, and it still happens. It's particular to a specific skin.

Do you have anything in extra.less? Maybe try clearing it and seeing if it goes away?
 
Yup, we are getting it on multiple sites, and it doesn't seem to be related to any particular plugin that I can track down.
 
We're also seeing this on both our fora as of upgrading to 2.3.5 (MySQL 10.6.20, PHP 8.4.3). Debug mode isn't enabled.
 
I'm not getting this error at all. I've been running 2.3.5 for 2 or 3 days now. I only use one skin, UI.X 2 Dark (2.3.5) and don't allow switching themes. Should I upgrade anyway?
 
It's not strictly urgent if you're not facing problems, but we always recommend running the latest version. It's a minor update so I wouldn't expect it to be too troublesome.
 
Back
Top Bottom