Skip to content

Commit

Permalink
Issue #315 Fix htmlspecialchars() warning for null values
Browse files Browse the repository at this point in the history
  • Loading branch information
mikehaertl committed Oct 17, 2023
1 parent bfe3d05 commit 8050285
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 8050285

Please sign in to comment.