contao/import — Issue #3199: [2.10 RC1] StyleSheets.php - Background colors not being parsed correctly with new transparency setting
Author: importer
Created: 2011-11-29 21:04:09+00:00
State: open
Labels: backend, Defect

Minor issue: If you look at line 465, you can see that the background color is checking for a string when it is now an array (with the transparency setting), so it will always be passed to compileColor() even with a blank array.

Just deserialize() beforehand and check for strlen on the first array element.

```
$bgColor = deserialize($row['bgcolor'], true);
// Try to shorten the definition
if ($row['bgimage']

![](= '' && $row['bgposition'] )= '' && $row['bgrepeat']

![](= '')
{
$return .= $lb . 'background:' . (($bgColor[0] )= '') ? $this->compileColor($row['bgcolor'], $blnWriteToFile) . ' ' : '') . 'url("' . $strGlue . $row['bgimage'] . '") ' . $row['bgposition'] . ' ' . $row['bgrepeat'] . ';';
}
else
{
// Background color
if ($bgColor[0] != '')
{
$return .= $lb . 'background-color:' . $this->compileColor($row['bgcolor'], $blnWriteToFile) . ';';
}
```

--- _Originally created by winanscreative on June 25th, 2011, at 07:11pm (ID 3199)_