From 01be377f93654fad4d3fbc8c81779f14316eaecf Mon Sep 17 00:00:00 2001 From: Olek Kaim <135211410+olekans@users.noreply.github.com> Date: Thu, 31 Oct 2024 03:57:29 +0100 Subject: [PATCH] fix: undefined array key warning (#419) --- library/HTMLPurifier/EntityParser.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/HTMLPurifier/EntityParser.php b/library/HTMLPurifier/EntityParser.php index 3ef2d09e..0f2b83dc 100644 --- a/library/HTMLPurifier/EntityParser.php +++ b/library/HTMLPurifier/EntityParser.php @@ -116,8 +116,8 @@ class HTMLPurifier_EntityParser protected function entityCallback($matches) { $entity = $matches[0]; - $hex_part = @$matches[1]; - $dec_part = @$matches[2]; + $hex_part = isset($matches[1]) ? $matches[1] : null; + $dec_part = isset($matches[2]) ? $matches[2] : null; $named_part = empty($matches[3]) ? (empty($matches[4]) ? "" : $matches[4]) : $matches[3]; if ($hex_part !== NULL && $hex_part !== "") { return HTMLPurifier_Encoder::unichr(hexdec($hex_part));