Review main Abandoned

84443[WIP][FEATURE] Enhance Fluid DebugViewHelper to be more integrator-helpful

Garvin Hicking CR 0 V 0 Expert +1076 −37 updated 09/09/24, 10:09

Commit message

While DebuggerUtility is helpful in PHP context to reveal information
about private/protected information, this is not so helpful for
integrators working with Fluid templates. There, the private/protected
properties cannot be accessed (unless proper getters exist, which
is not easily revealed).

Additionally, integrators may be missing the availibility of
"hidden" getters that actually access private/protected properties.

To improve this, the fluid `DebugViewHelper` can now inspect getters
(under certain restrictions). The behaviour to filter protected/private
properties can be controlled with an argument "filterProtected"
to the ViewHelper. Also "filterMethods" and "eagerInspection" can
be used (see Feature-Changelog entry). These filter options are
implemented using a enum-backed bitmask of filter options.

The `DebuggerUtility::var_dump()` when used in PHP-scope itself
still displays private/protected variables and does not reveal
getter methods, just like before.

"Unsafe" getter execution is performed via statical analysis
using PhpParser, and blacklists certain operations like
other function/method calls that could lead to unwanted code
execution. This can be overridden using eagerInspection that
allows to call any getter.

Tests are added to verify blacklisting behavior as well as the
enum-backed bitmask functionality.

TODO:

* An example composer package garvinhicking/gh-validationdummy can be
  installed to provide the example structure of a Domain Model to be
  debugged to see the output. That extension is compatible to
  main and v12 so that differences can easily be compared in two
  installations
* Did I mention, this is work in progress. Feedback and help
  welcome. There are probably edge-case scenarios in which this
  code magically either works or not due. I tried to use a very
  pessimistic approach to getter logic, so that a getter is better
  not executed than executed and causing trouble. Due to the
  output hinting at the getter, at least this can be properly
  debugged then and improves the situation.
* See the ticket for a recent screenshot of output generated by
  this.

Review

  • Code review CR 0
  • Verified V 0

Issues 2

Files 7

Review log 1017

  1. Garvin Hicking uploaded patch set 1 05/29/24, 13:11

  2. core-ci voted on patch set 1 V -1 05/29/24, 13:16 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58445

  3. Garvin Hicking uploaded patch set 2 V -1 05/29/24, 13:17

    Feature RST
  4. Garvin Hicking uploaded patch set 3 05/29/24, 13:18

    CGL
  5. core-ci voted on patch set 2 V -1 05/29/24, 13:23 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58446

  6. core-ci voted on patch set 3 V +1 05/29/24, 13:25 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58447

  7. Garvin Hicking uploaded patch set 4 V +1 05/29/24, 14:21

    Fix missing filterProtected propagation and multibyte op
  8. core-ci voted on patch set 4 V +1 05/29/24, 14:25 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58448

  9. Garvin Hicking uploaded patch set 5 V +1 05/30/24, 14:22

    Doing the lords work on a vacation day
  10. core-ci voted on patch set 5 V -1 05/30/24, 14:28 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58492

  11. Garvin Hicking uploaded patch set 6 V -1 05/30/24, 14:46

    CGL
  12. core-ci voted on patch set 6 V -1 05/30/24, 14:52 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58493

  13. Garvin Hicking uploaded patch set 7 V -1 05/30/24, 14:56

    CGL continued
  14. core-ci voted on patch set 7 V +1 05/30/24, 15:01 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58494

  15. Garvin Hicking commented on patch set 7 05/30/24, 22:24

    NodeVisitorForDebuggerUtilityTest.php:34 Unresolved

    note to self: remove accidental debug code
  16. Garvin Hicking commented on patch set 7 09/09/24, 10:09

    I am abandoning this effort. I found EXT:includekrexx is an awesome solution to this problem that should be advertised.
  17. Garvin Hicking abandoned the change 09/09/24, 10:09