Review 12.4 Merged

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

Christian Weiske CR +2 V +2 Easy +9 −2 updated 07/01/25, 07:05

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
    • Stefan Bürk +2
    • Garvin Hicking +1
    • Simon Schaufelberger +1
  • Verified V +2 Done
    • Stefan Bürk +2
    • Garvin Hicking +1
    • Simon Schaufelberger +1
    • core-ci +1 CI

Issues 1

Files 2

Review log 1012

  1. Christian Weiske uploaded patch set 1 06/25/25, 08:26

  2. Christian Weiske commented on patch set 1 06/25/25, 08:27

    This is the backport of #88737 to 12.4. I'm not sure how this process works, but I can confirm that the problem exists and is solved with the patch in 12.4.
  3. core-ci voted on patch set 1 V -1 06/25/25, 08:35 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/80828

  4. Christian Weiske rebased onto patch set 2 V -1 06/25/25, 20:52

  5. core-ci voted on patch set 2 V +1 06/25/25, 21:21 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/80924

  6. Garvin Hicking voted on patch set 2 CR +1 V +1 06/26/25, 07:53

  7. Simon Schaufelberger voted on patch set 2 CR +1 V +1 06/30/25, 08:02

  8. Stefan Bürk voted on patch set 2 CR +2 V +2 07/01/25, 04:10

  9. Stefan Bürk voted on patch set 2 CR 0 V 0 07/01/25, 04:11

  10. Stefan Bürk commented on patch set 2 CR +2 V +2 07/01/25, 05:30

    @typo3-2024@cweiske.de Note that there is no guaranteed planned 12.4 release anymore on the schedule https://typo3.org/cms/roadmap/maintenance-releases So you need to use it as composer patch anyway. In general, 12.4 is in priority/security only bugfix mode,not considering this one as such in general. Making a little excamption on it as it is quite small. Just be aware that it may be possible that there will be no release for a long time containing this bugfix.
  11. Stefan Bürk merged patch set 3 07/01/25, 05:31

  12. Christian Weiske commented on patch set 3 07/01/25, 07:05

    Reply

    Thank you for the explanation. I'd say that a bug that causes 100% CPU load and brings down the server is a security issue 😊