Skip to content

Commit

Permalink
Merge pull request #316 from mikehaertl/315-fix-null-values
Browse files Browse the repository at this point in the history
Issue #315 Fix htmlspecialchars() warning for null values
  • Loading branch information
mikehaertl authored Nov 3, 2023
2 parents 9e01722 + 8050285 commit 3851b08
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/XfdfFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,14 @@ protected function writeFields($fp, $fields)
}

/**
* @param string $value the value to encode
* @return string the value correctly encoded for use in a XML document
* @param string|null $value the value to encode
* @return string|null the value correctly encoded for use in a XML document
*/
protected function xmlEncode($value)
{
if ($value === null) {
return null;
}
return defined('ENT_XML1') ?
htmlspecialchars($value, ENT_XML1, 'UTF-8') :
htmlspecialchars($value);
Expand Down

0 comments on commit 3851b08

Please sign in to comment.