Skip to content

Commit 0a66ce3

Browse files
author
MarkBaker
committed
Escape double quotes in a string value unless it's an empty string value
1 parent 51453db commit 0a66ce3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/PhpSpreadsheet/Calculation/Functions.php

+4
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,10 @@ public static function ifCondition($condition)
158158
if (is_bool($condition)) {
159159
return '=' . ($condition ? 'TRUE' : 'FALSE');
160160
} elseif (!is_numeric($condition)) {
161+
if ($condition !== '""') { // Not an empty string
162+
// Escape any quotes in the string value
163+
$condition = preg_replace('/"/ui', '""', $condition);
164+
}
161165
$condition = Calculation::wrapResult(strtoupper($condition));
162166
}
163167

0 commit comments

Comments
 (0)