Not a bug Malformed style property causes master data rebuild to fail

Xon

Well-known member
Affected version
2.0.9
I believe this is from a semi-ported XF1 add-on, but I'm having trouble finding which one it is.

Code:
  [ErrorException]
  [E_WARNING] trim() expects parameter 1 to be string, array given


Exception trace:
() at /var/www/sites/xf2.sufficientvelocity.com/html/src/XF/Service/StyleProperty/Rebuild.php:392
XF::handlePhpError() at n/a:n/a
trim() at /var/www/sites/xf2.sufficientvelocity.com/html/src/XF/Service/StyleProperty/Rebuild.php:392
XF\Service\StyleProperty\Rebuild->standardizeLessCacheValue() at /var/www/sites/xf2.sufficientvelocity.com/html/src/XF/Service/StyleProperty/Rebuild.php:288
XF\Service\StyleProperty\Rebuild->getPropertyCacheValue() at /var/www/sites/xf2.sufficientvelocity.com/html/src/XF/Service/StyleProperty/Rebuild.php:181
XF\Service\StyleProperty\Rebuild->_rebuildPropertyStyleCacheForStyle() at /var/www/sites/xf2.sufficientvelocity.com/html/src/XF/Service/StyleProperty/Rebuild.php:164
XF\Service\StyleProperty\Rebuild->rebuildPropertyStyleCacheForStyle() at /var/www/sites/xf2.sufficientvelocity.com/html/src/XF/Service/StyleProperty/Rebuild.php:115
XF\Service\StyleProperty\Rebuild->rebuildPropertyStyleCache() at /var/www/sites/xf2.sufficientvelocity.com/html/src/XF/Job/StylePropertyRebuild.php:15
XF\Job\StylePropertyRebuild->run() at /var/www/sites/xf2.sufficientvelocity.com/html/src/XF/Job/Atomic.php:38
XF\Job\Atomic->run() at /var/www/sites/xf2.sufficientvelocity.com/html/src/XF/Job/Manager.php:241
XF\Job\Manager->runJobInternal() at /var/www/sites/xf2.sufficientvelocity.com/html/src/XF/Job/Manager.php:187
XF\Job\Manager->runJobEntry() at /var/www/sites/xf2.sufficientvelocity.com/html/src/XF/Job/Manager.php:138
XF\Job\Manager->runUnique() at /var/www/sites/xf2.sufficientvelocity.com/html/src/XF/Cli/Command/JobRunnerTrait.php:30
XF\Cli\Command\Upgrade->runJob() at /var/www/sites/xf2.sufficientvelocity.com/html/src/XF/Cli/Command/Upgrade.php:200
XF\Cli\Command\Upgrade->execute() at /var/www/sites/xf2.sufficientvelocity.com/html/src/vendor/symfony/console/Command/Command.php:242
Symfony\Component\Console\Command\Command->run() at /var/www/sites/xf2.sufficientvelocity.com/html/src/vendor/symfony/console/Application.php:843
Symfony\Component\Console\Application->doRunCommand() at /var/www/sites/xf2.sufficientvelocity.com/html/src/vendor/symfony/console/Application.php:193
Symfony\Component\Console\Application->doRun() at /var/www/sites/xf2.sufficientvelocity.com/html/src/vendor/symfony/console/Application.php:117
Symfony\Component\Console\Application->run() at /var/www/sites/xf2.sufficientvelocity.com/html/src/XF/Cli/Runner.php:63
XF\Cli\Runner->run() at /var/www/sites/xf2.sufficientvelocity.com/html/cmd.php:16

PHP:
        foreach ($values AS $k => &$value)
        {
            $value = trim($value);
            if ($value === '')
            {
                unset($values[$k]);
            }
        }

This looks to be the result of porting an XF1 add-on to XF2. Dumping $k & $value results in;
Code:
string(15) "text-decoration"
array(1) {
  'none' =>
  string(4) "none"
}
 
Code:
ErrorException: [E_WARNING] trim() expects parameter 1 to be string, array given src\XF\Service\StyleProperty\Rebuild.php:392

Quick var dump shows
HTML:
<pre>array(4) {
  ["background-color"] => string(17) "@secondaryLighter"
  ["border-color"] => string(15) "@secondaryLight"
  ["color"] => string(14) "@secondaryDark"
  ["text-decoration"] => &array(1) {
    ["none"] => string(4) "none"
  }
}
</pre>
 
I’ve not looked into this properly, yet, but are you guys doing anything specific which is importing XF1 add on data post upgrade to XF2?

Reason I ask is that the upgrade to XF 2.0 actually drops all of the XF1 style property tables, as far as I can recall, so these values shouldn’t be there in normal circumstances.
 
Top Bottom