Open lenhatthanh20 opened 6 months ago
What is the value of $attr
and $key
if you dump the values? It's perhaps something to do with 10
not being a valid attribute name.
When I dump the value:
$key
is 10
(non-string)$value
is hoge
In my example, the attribute key is 10
and the value is hoge
. I know the attribute key 10
is invalid because it is a non-string
.
But my expected is:
<a href="https://example.com/">Test</a>
(remove invalid attribute 10
)
https://github.com/ezyang/htmlpurifier/blob/bbc513d79acf6691fa9cf10f192c90dd2957f18c/library/HTMLPurifier/Token/Tag.php#L47
Hello, When I use HTML Purifier with
Core.LexerImpl = DirectLex
, The PHP error will cause in above line when I purify the below data:<a href="https://example.com/" 10="hoge">Test</a>
Because the key of attribute isnon-string
value. So the PHP error will be occured. Ref: https://www.php.net/manual/en/function.ctype-lower.phpPlease help to fix it. I think we can fix it by using quick typecast in the
Tag.php
file:$key = (string)$key;
Or remove the attribute if the key is non-string value.
Thank you so much