#102360typo3 CLI: TextDescriptor throws exception on null description
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"
}
}
}