Actions
Bug #102360
closedtypo3 CLI: TextDescriptor throws exception on null description
Status:
Closed
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