Skip to content

Commit

Permalink
Considered null in xmlspecialchars
Browse files Browse the repository at this point in the history
  • Loading branch information
jwakelim committed Jan 30, 2023
1 parent 291cc6e commit bc974b9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/XlsxWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class XlsxWriter
protected $company;
protected $description;
protected $keywords = array();
protected $tempdir;

protected $current_sheet;
protected $sheets = array();
Expand Down Expand Up @@ -758,7 +759,7 @@ public static function xmlspecialchars($val)
//note, badchars does not include \t\n\r (\x09\x0a\x0d)
static $badchars = "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0b\x0c\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x7f";
static $goodchars = " ";
return strtr(htmlspecialchars($val, ENT_QUOTES | ENT_XML1), $badchars, $goodchars);//strtr appears to be faster than str_replace
return (!is_null($val)) ? strtr(htmlspecialchars($val, ENT_QUOTES | ENT_XML1), $badchars, $goodchars) : '';//strtr appears to be faster than str_replace
}
//------------------------------------------------------------------
public static function array_first_key(array $arr)
Expand Down

0 comments on commit bc974b9

Please sign in to comment.