]> _ Git - fluidbook-toolbox.git/commitdiff
wait #4632 @1.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 30 Jul 2021 14:00:30 +0000 (16:00 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 30 Jul 2021 14:00:30 +0000 (16:00 +0200)
app/Jobs/UpdateWS2ThemeTable.php
app/Models/FluidbookTheme.php

index 4fd7ce09058aff4ee82a98b43b33528432a2ab9e..132126041af816950dad3c2e55e3fb36831335e1 100644 (file)
@@ -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';
index 670f1e71165d50f39dcdcfcb60dbb53632304423..789995d1f3a801555ac399429f6497aac878307f 100644 (file)
@@ -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) {