Skip to content

Commit 8050285

Browse files
committed
Issue #315 Fix htmlspecialchars() warning for null values
1 parent bfe3d05 commit 8050285

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)