Skip to content

Commit b2a9710

Browse files
committed
Bug-fix.
Changelog excerpt: - Parameters containing spaces weren't being parsed correctly by the recursiveCommand method; Fixed.
1 parent eb13df0 commit b2a9710

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

Changelog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,8 @@ __*Why "v3.0.0" instead of "v1.0.0?"*__ Prior to phpMussel v3, the "phpMussel Co
4747

4848
- [2024.07.02]: Merged zh and zh-TW L10N, and dropped region designations (e.g., CN, TW) in favour of script designations (e.g., Hans, Hant).
4949
- [2024.09.02]: Code-style patch.
50+
51+
### v3.4.0
52+
53+
#### Bugs fixed.
54+
- [2024.10.15]: Parameters containing spaces weren't being parsed correctly by the recursiveCommand method; Fixed.

src/CLI.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* License: GNU/GPLv2
99
* @see LICENSE.txt
1010
*
11-
* This file: CLI handler (last modified: 2024.09.02).
11+
* This file: CLI handler (last modified: 2024.10.15).
1212
*/
1313

1414
namespace phpMussel\CLI;
@@ -280,7 +280,12 @@ public function __construct(\phpMussel\Core\Loader &$Loader, \phpMussel\Core\Sca
280280
*/
281281
public function recursiveCommand(string $Command, callable $Callable): string
282282
{
283-
[$Command, $Params] = explode(' ', $Command);
283+
if (preg_match('~^([^ "]+) "([^"]+)"$~', $Command, $Matches)) {
284+
$Command = $Matches[1];
285+
$Params = $Matches[2];
286+
} else {
287+
[$Command, $Params] = strpos($Command, ' ') === false ? [$Command, ''] : explode(' ', $Command, 2);
288+
}
284289
if (is_dir($Params)) {
285290
if (!is_readable($Params)) {
286291
return sprintf($this->Loader->L10N->getString('response.Failed to access %s'), $Params) . "\n";

0 commit comments

Comments
 (0)