Project

General

Profile

Actions

Bug #102360

closed

typo3 CLI: TextDescriptor throws exception on null description

Added by Moritz Karbaum 6 months ago. Updated 6 months ago.

Status:
Resolved
Priority:
Should have
Assignee:
-
Category:
CLI
Target version:
-
Start date:
2023-11-10
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
12
PHP Version:
8.1
Tags:
Complexity:
no-brainer
Is Regression:
Sprint Focus:

Description

If I run ./vendor/bin/typo3 --raw --format=txt on the cli I get an exception:

Uncaught TYPO3 Exception strip_tags(): Argument #1 ($string) must be of type string, null given
thrown in file /var/www/html/backend/vendor/typo3/cms-core/Classes/Command/Descriptor/TextDescriptor.php
in line 57

The offend line of code is: $this->write(sprintf("%-{$width}s %s\n", $command['name'], strip_tags($command['description'])), true);

If a 3rd party extension doesn't define a description, strip_tags won't like that.

strip_tags($command['description'] ?? '') should suffice.

Edit: Composer Patch

cms-core-textdescriptor-description.patch

--- a/Classes/Command/Descriptor/TextDescriptor.php
+++ b/Classes/Command/Descriptor/TextDescriptor.php
@@ -54,7 +54,7 @@
             $width = $this->getColumnWidth(['' => ['commands' => array_keys($commands)]]);

             foreach ($commands as $command) {
-                $this->write(sprintf("%-{$width}s %s\n", $command['name'], strip_tags($command['description'])), true);
+                $this->write(sprintf("%-{$width}s %s\n", $command['name'], strip_tags($command['description'] ?? '')), true);
             }
             return;
         }

composer.patches.json

{
    "patches": {
        "typo3/cms-core": {
            "typo3 CLI description": "patches/cms-core-textdescriptor-description.patch" 
        }
    }
}

Actions #1

Updated by Moritz Karbaum 6 months ago

  • Description updated (diff)
Actions #2

Updated by Gerrit Code Review 6 months ago

  • Status changed from New to Under Review

Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/81834

Actions #3

Updated by Gerrit Code Review 6 months ago

Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/81834

Actions #4

Updated by Gerrit Code Review 6 months ago

Patch set 3 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/81834

Actions #5

Updated by Gerrit Code Review 6 months ago

Patch set 4 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/81834

Actions #6

Updated by Gerrit Code Review 6 months ago

Patch set 5 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/81834

Actions #7

Updated by Gerrit Code Review 6 months ago

Patch set 1 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/81788

Actions #8

Updated by Anonymous 6 months ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions

Also available in: Atom PDF