Bug #102360
closedtypo3 CLI: TextDescriptor throws exception on null description
100%
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" } } }
Updated by Gerrit Code Review about 1 year 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
Updated by Gerrit Code Review about 1 year 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
Updated by Gerrit Code Review about 1 year 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
Updated by Gerrit Code Review about 1 year 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
Updated by Gerrit Code Review about 1 year 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
Updated by Gerrit Code Review about 1 year 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
Updated by Anonymous about 1 year ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset f8e1a613cbdb54b71e3223fa8eff0a05ac8b2f2a.