snappymail/snappymail/v/0.0.0/app/libraries/MailSo/Base
Fathi Ben Nasr 08ddc323f9 HtmlUtils: strip every data-* attribute, not just the first one
BuildHtml() iterates $oElement->attributes -- a live DOMNamedNodeMap --
and calls removeAttribute() on the attribute the foreach is currently on.
That ends the iteration: the loop sees no further attribute, so exactly
one data-* is removed per element however many it carries.

Measured on PHP 8.5.10 / libxml 2.12.5, data-* left behind:

  <p data-a>                          -> none
  <p data-a data-b>                   -> data-b
  <p data-a data-b data-c>            -> data-b, data-c
  <p data-a data-b data-c data-d>     -> data-b, data-c, data-d
  <p DATA-A data-b>                   -> data-b

The single call site is buildMessage() in RainLoop/Actions/Messages.php,
reached from both DoSaveMessage() and DoSendMessage(), as the docblock on
BuildHtml() says. So the attributes that survive go out in the sent
message and into the draft that is APPENDed and read back later. It is
not the display path: an incoming body is only decoded and charset
converted in MailSo\Mail\Message::fromFetchResponse(), and the browser
filters it with the allowlists in dev/Common/Html.js.

The fix collects the names first, then removes them.
2026-09-05 21:44:57 +00:00
..
Enumerations cleanup mime header encoding handling 2024-01-22 09:19:45 +01:00
StreamFilters Resolve #610 PHP 8.2 2022-11-02 09:21:04 +01:00
StreamWrappers PHP 8.4: Implicitly nullable parameter declarations deprecated 2024-09-17 15:58:37 +02:00
Collection.php PHP 8.4: Implicitly nullable parameter declarations deprecated 2024-09-17 15:58:37 +02:00
DateTimeHelper.php Catch Throwable for #1914 2025-06-16 17:35:11 +02:00
HtmlUtils.php HtmlUtils: strip every data-* attribute, not just the first one 2026-09-05 21:44:57 +00:00
Http.php Bugfix: Undefined variable $sFilename 2024-04-28 13:55:52 +02:00
Locale.php Replace PHP 8.2.0 deprecated utf8_decode/utf8_encode 2022-10-06 09:43:34 +02:00
ResourceRegistry.php MailSo class properties to typed properties and clean up 2022-12-20 20:17:11 +01:00
Utils.php fix regex match-group 2025-05-25 21:13:55 +02:00
Xxtea.php MailSo class properties to typed properties and clean up 2022-12-20 20:17:11 +01:00