Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions library/HTMLPurifier/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public function generateFromToken($token)

} elseif ($token instanceof HTMLPurifier_Token_Empty) {
if ($this->_flashCompat && $token->name == "param" && !empty($this->_flashStack)) {
$this->_flashStack[count($this->_flashStack)-1]->param[$token->attr['name']] = $token->attr['value'];
$this->_flashStack[count($this->_flashStack)-1]->param[$token->attr['name'] ?? ''] = $token->attr['value'] ?? '';
}
$attr = $this->generateAttributes($token->attr, $token->name);
return '<' . $token->name . ($attr ? ' ' : '') . $attr .
Expand Down Expand Up @@ -248,10 +248,10 @@ public function generateAttributes($assoc_array_of_attributes, $element = '')
// don't process user input with innerHTML or you don't plan
// on supporting Internet Explorer.
if ($this->_innerHTMLFix) {
if (strpos($value, '`') !== false) {
if (strpos($value ?? '', '`') !== false) {
// check if correct quoting style would not already be
// triggered
if (strcspn($value, '"\' <>') === strlen($value)) {
if (strcspn($value ?? '', '"\' <>') === strlen($value ?? '')) {
// protect!
$value .= ' ';
}
Expand Down Expand Up @@ -279,7 +279,7 @@ public function escape($string, $quote = null)
if ($quote === null) {
$quote = ENT_COMPAT;
}
return htmlspecialchars($string, $quote, 'UTF-8');
return htmlspecialchars($string ?? '', $quote, 'UTF-8');
}
}

Expand Down