From 1647e402b4c1fe3ec5b1bfa70cf2b83131fb81ee Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 23 Apr 2026 03:47:30 +0000 Subject: [PATCH] fix: resolve array to string conversion and multiple filters handling in Rclone::withFilter This commit fixes a bug where `FilterBuilder::toFlags()` was being used to merge filters into the `$operation_flags` array, causing two problems: 1. When multiple includes/excludes were provided, they formed nested arrays (e.g., `['include' => ['*.txt', '*.jpg']]`) which triggered an `Array to string conversion` warning in `CommandBuilder::prefixFlags`. 2. Environment variables limit passing multiple identical flags to the rclone binary, effectively breaking multiple includes/excludes. The fix resolves this by calling `$this->filter->toArgs()` instead and merging those generated args into the sequential `$args` array, ensuring multiple `--include` or `--exclude` flags are passed correctly as CLI arguments. Co-authored-by: insign <1113045+insign@users.noreply.github.com> --- src/Rclone.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Rclone.php b/src/Rclone.php index c663a92..5edde93 100644 --- a/src/Rclone.php +++ b/src/Rclone.php @@ -416,9 +416,9 @@ private function _run(string $command, array $args = [], array $operation_flags $operation_flags['dry-run'] = true; } - // Apply filter flags if set + // Apply filter args if set if ($this->filter !== null && $this->filter->hasFilters()) { - $operation_flags = array_merge($operation_flags, $this->filter->toFlags()); + $args = array_merge($args, $this->filter->toArgs()); } $commandArgs = CommandBuilder::buildCommandArgs(self::getBIN(), $command, $args);