From: Vincent Vanwaelscappel Date: Fri, 30 Jul 2021 14:00:30 +0000 (+0200) Subject: wait #4632 @1.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=50821cdb09b540efc8609e8abe9c710265ef5127;p=fluidbook-toolbox.git wait #4632 @1.5 --- diff --git a/app/Jobs/UpdateWS2ThemeTable.php b/app/Jobs/UpdateWS2ThemeTable.php index 4fd7ce090..132126041 100644 --- a/app/Jobs/UpdateWS2ThemeTable.php +++ b/app/Jobs/UpdateWS2ThemeTable.php @@ -99,7 +99,7 @@ class UpdateWS2ThemeTable implements ShouldQueue if (in_array($k, $this->_ignore)) { continue; } - $v = $theme->$k; + $v = (string)$theme->$k; if (in_array($k, $this->_colorAlphaFields)) { $v = self::colorAlphaToWS2($v); @@ -161,7 +161,9 @@ class UpdateWS2ThemeTable implements ShouldQueue protected static function _colorToWS2($data, $alpha): string { $data = trim($data, '# '); - if (strlen($data) === 6) { + if (strlen($data) < 6) { + $res = str_repeat('0', 6 - mb_strlen($data)) . $data; + } else if (strlen($data) === 6) { $res = $data; } else if ($data === 'transparent') { $res = '00000000'; diff --git a/app/Models/FluidbookTheme.php b/app/Models/FluidbookTheme.php index 670f1e711..789995d1f 100644 --- a/app/Models/FluidbookTheme.php +++ b/app/Models/FluidbookTheme.php @@ -616,6 +616,9 @@ class FluidbookTheme extends CubistMagicAbstractModel public static function _colorToWS3($data) { if (!isset(self::$_colorToWS3Cache[$data])) { + if (strlen($data) < 6) { + $data = str_repeat('0', 6 - strlen($data)) . $data; + } if (strlen($data) === 6) { $res = '#' . $data; } else if (strlen($data) === 8) {