Issue Bug Closed

#96567php ast catches wrong class

Tobias Kasprak 01/18/22, 10:05 updated 10/04/22, 14:14

Description

PHP AST recognizes the RecordsContentObject but mistakenly recognizes it as a PageRenderer and captures it as a page render class. This triggers the following error Breaking: #93003 – PageRenderer renders only full page
example method which throws the error
public function render() {
$conf = $this->buildConfArray($this->arguments[‘uid’]);
$recordsObjectManager = $this->objectManager->get(RecordsContentObject::class);
return $this->RecordsContentObject->render($conf);
}
I would like to request a modification of the scanner.

Reviews 2

Files 1

History 68

  1. Georg Ringer commented and changed status New Needs Feedback 01/19/22, 19:08

    thanks for creating the issue!

    this is a weak and as there is only a static code check this is IMO fine. Read more about it at https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/ExtensionScanner/Index.html

    it is ok to close the issue?

  2. Christian Kuhn commented 01/22/22, 20:14

    Hey.

    As Georg already mentioned, this is a limit of the extension scanner. For non-static method calls, it basically does not know which on which object/class the method is called, so it just classifies the matching method name as “weak” match: A candidate to check.

    For more information, see https://docs.typo3.org/m/typo3/reference-coreapi/11.5/en-us/ApiOverview/ExtensionScanner/Index.html#limits .

  3. Christian Kuhn commented 01/22/22, 20:17

    However, since render() is such a generic method name, we are probably better off removing that matcher from the configuration and maybe adapt the .rst file of #93003 to ‘not scanned’. This will help avoiding too many false positives in this very case.

  4. Christian Kuhn changed Related to #93003 01/22/22, 20:17

  5. Gerrit Code Review pushed patch set 1 for main to change 73132 status Needs Feedback Under Review 01/23/22, 10:35

  6. Gerrit Code Review pushed patch set 1 for 11.5 to change 73089 01/24/22, 14:45

  7. Christian Kuhn commented and changed status Under Review Resolved done 0 % 100 % 01/24/22, 14:50

    Applied in changeset commit:50d4e2c3c969d1951e88328a9f08e53913d52a07.

  8. Benni Mack changed status Resolved Closed 10/04/22, 14:14