Review 13.4 Merged

88743[BUGFIX] Avoid PHP bug when a link was not created via HtmlWorker

Benni Mack CR +2 V +2 Easy +9 −2 updated 03/25/25, 13:49

Commit message

When using HtmlWorker (e.g. in Backend Login's system news),
there was a PHP error in DomDocument.

When a link was not possible to generate (example: a page
was deleted) then a "UnableToLinkException" is thrown
and just the contents of the <a> tag (incl. spans, strong etc)
are rendered.

However, as it turns out, the inner workings of replacing
this in DomElement (as done in HtmlWorker, whereas in
lib.parseFunc this is purely done with a string/array magic)
"in-place" causes a memory issue resulting in killing
PHP on ones' server (100% system load).

The solution is to clone the child nodes in DomDocument, and
append them before the element, then removing the actual
<a> tag ($element) in this case.

Review

  • Code review CR +2 Done
    • Benni Mack +2
  • Verified V +2 Done
    • Benni Mack +2
    • core-ci +1 CI

Issues 1

Files 2

Review log 34

  1. Benni Mack commented on patch set 1 03/25/25, 13:36

    Cherry Picked from branch main.
  2. core-ci voted on patch set 1 V +1 03/25/25, 13:45 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/76258

  3. Benni Mack voted on patch set 1 CR +2 V +2 03/25/25, 13:49

  4. Benni Mack merged patch set 2 03/25/25, 13:49