From 1f67c993e286b642f8d5600f302d6351d8565ef0 Mon Sep 17 00:00:00 2001 From: Ciki Date: Tue, 22 Dec 2020 12:12:18 +0100 Subject: [PATCH 1/2] Fix deprecated warning for non-hexadecimal number I've come across this deprecated warning when trying to save docx to pdf.. if cellBgColor is set to `auto` it should be converted back to `null` which has in practice the same functionality. --- src/PhpWord/Writer/HTML/Element/Table.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/PhpWord/Writer/HTML/Element/Table.php b/src/PhpWord/Writer/HTML/Element/Table.php index a6f14792f8..f19ad68332 100644 --- a/src/PhpWord/Writer/HTML/Element/Table.php +++ b/src/PhpWord/Writer/HTML/Element/Table.php @@ -52,6 +52,7 @@ public function write() for ($j = 0; $j < $rowCellCount; $j++) { $cellStyle = $rowCells[$j]->getStyle(); $cellBgColor = $cellStyle->getBgColor(); + $cellBgColor === 'auto' && $cellBgColor = null; // Fix deprecated warning for non-hexadecimal number $cellFgColor = null; if ($cellBgColor) { $red = hexdec(substr($cellBgColor, 0, 2)); From 13384f63d3e001b5ebcea3007533f8acb89cf5f4 Mon Sep 17 00:00:00 2001 From: troosan Date: Fri, 5 Feb 2021 21:15:51 +0100 Subject: [PATCH 2/2] update comment --- src/PhpWord/Writer/HTML/Element/Table.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhpWord/Writer/HTML/Element/Table.php b/src/PhpWord/Writer/HTML/Element/Table.php index f19ad68332..059574a272 100644 --- a/src/PhpWord/Writer/HTML/Element/Table.php +++ b/src/PhpWord/Writer/HTML/Element/Table.php @@ -52,7 +52,7 @@ public function write() for ($j = 0; $j < $rowCellCount; $j++) { $cellStyle = $rowCells[$j]->getStyle(); $cellBgColor = $cellStyle->getBgColor(); - $cellBgColor === 'auto' && $cellBgColor = null; // Fix deprecated warning for non-hexadecimal number + $cellBgColor === 'auto' && $cellBgColor = null; // auto cannot be parsed to hexadecimal number $cellFgColor = null; if ($cellBgColor) { $red = hexdec(substr($cellBgColor, 0, 2));