joomla / joomla-cms

Home of the Joomla! Content Management System
https://www.joomla.org
GNU General Public License v2.0
4.77k stars 3.65k forks source link

Code logic makes no sense in ColorField #31067

Closed PhilETaylor closed 2 years ago

PhilETaylor commented 4 years ago

Steps to reproduce the issue

Code review

https://github.com/joomla/joomla-cms/blob/e27012ade3a0f7e58888465b4be4a73e449ceb18/libraries/src/Form/Field/ColorField.php#L327

English: if $this->split is not set we do some math... and then immediately overwrite the result of the math but going and checking $this->split again and if its not set, hard coding a 3....

That makes no sense?

wilsonge commented 3 years ago

Removed the J4 tag on this issue as it's an issue since https://github.com/joomla/joomla-cms/pull/11030 so affects all of 3.x too

wilsonge commented 3 years ago

So I thought about reverting that to the local variable. But given the class property is 3 by default. I have a feeling the 'maths' is just total junk - I can't think of a way $this->split can ever be false