Skip to content
Snippets Groups Projects
Commit 2c72e747 authored by Andreas Kienast's avatar Andreas Kienast
Browse files

[BUGFIX] Handle excess whitespace characters in `CommandUtility::exec()`

PHP's behavior of `exec()` [1] is flabbergasting: when writing the
buffer, trailing whitespace characters are trimmed as follows:

1. the last PHP_EOL character is chopped
2. any left-over trailing literal space characters are trimmed

Neither of this was handled in the implementation introduced
in #104045, leading to unexpected output.

This commit emulates the behavior of PHP's internal `exec()` function,
restoring the previous behavior of `CommandUtility::exec()`.

[1] https://github.com/php/php-src/blob/master/ext/standard/exec.c

Resolves: #105251
Related: #104045
Releases: main
Change-Id: I726b6ac0214f2cb3983db7b66c366a1fa58f93f8
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/86533


Reviewed-by: default avatarBenjamin Kott <benjamin.kott@outlook.com>
Tested-by: default avatarBenjamin Kott <benjamin.kott@outlook.com>
Tested-by: default avatarBenjamin Franzke <ben@bnf.dev>
Tested-by: default avatarcore-ci <typo3@b13.com>
Reviewed-by: default avatarAndreas Kienast <akienast@scripting-base.de>
Tested-by: default avatarAndreas Kienast <akienast@scripting-base.de>
Reviewed-by: default avatarBenjamin Franzke <ben@bnf.dev>
parent d604d241
Branches
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment