Skip to content

Commit 3851b08

Browse files
authored
Merge pull request #316 from mikehaertl/315-fix-null-values
Issue #315 Fix htmlspecialchars() warning for null values
2 parents 9e01722 + 8050285 commit 3851b08

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/XfdfFile.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,11 +218,14 @@ protected function writeFields($fp, $fields)
218218
}
219219

220220
/**
221-
* @param string $value the value to encode
222-
* @return string the value correctly encoded for use in a XML document
221+
* @param string|null $value the value to encode
222+
* @return string|null the value correctly encoded for use in a XML document
223223
*/
224224
protected function xmlEncode($value)
225225
{
226+
if ($value === null) {
227+
return null;
228+
}
226229
return defined('ENT_XML1') ?
227230
htmlspecialchars($value, ENT_XML1, 'UTF-8') :
228231
htmlspecialchars($value);

0 commit comments

Comments
 (0)