Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Scheduler] Fix array to string conversion in #[AsCronTask] arguments#63001

Merged
nicolas-grekas merged 1 commit into
symfony:6.4from
serhiilabs:fix/scheduler-array-arguments-conversion-7.3
Jan 8, 2026
Merged

[Scheduler] Fix array to string conversion in #[AsCronTask] arguments#63001
nicolas-grekas merged 1 commit into
symfony:6.4from
serhiilabs:fix/scheduler-array-arguments-conversion-7.3

Conversation

@serhiilabs
Copy link
Copy Markdown
Contributor

@serhiilabs serhiilabs commented Jan 8, 2026

Q A
Branch? 6.4
Bug fix? yes
New feature? no
Deprecations? no
Issues Fix #62986
License MIT

The AsCronTask attribute accepts array|string|null for the arguments parameter, but passing an array throws "Array to string conversion" because the compiler pass interpolates it directly into a string.

#[AsCronTask('* * * * *', arguments: ['arg1', 'arg2'])]
final class MyCommand extends Command { ... }
Warning: Array to string conversion in AddScheduleMessengerPass.php

The fix converts array arguments to a properly escaped string using the same logic as Input::escapeToken().

#[AsCronTask('* * * * *', arguments: ['arg1', 'arg2'])]
// my:command arg1 arg2

#[AsCronTask('* * * * *', arguments: ['hello world', 'foo'])]
// my:command 'hello world' foo

@serhiilabs serhiilabs requested a review from kbond as a code owner January 8, 2026 11:53
@carsonbot carsonbot added this to the 7.3 milestone Jan 8, 2026
@serhiilabs serhiilabs force-pushed the fix/scheduler-array-arguments-conversion-7.3 branch from c0c2f40 to 8e8253d Compare January 8, 2026 12:04
@OskarStark OskarStark changed the title [Scheduler] Fix array to string conversion in AsCronTask arguments [Scheduler] Fix array to string conversion in #[AsCronTask] arguments Jan 8, 2026
Comment thread src/Symfony/Component/Scheduler/DependencyInjection/AddScheduleMessengerPass.php Outdated
@symfony symfony deleted a comment from carsonbot Jan 8, 2026
@serhiilabs serhiilabs force-pushed the fix/scheduler-array-arguments-conversion-7.3 branch from 8e8253d to 082e9e3 Compare January 8, 2026 14:30
Comment thread src/Symfony/Component/Scheduler/DependencyInjection/AddScheduleMessengerPass.php Outdated
@nicolas-grekas nicolas-grekas changed the base branch from 7.3 to 6.4 January 8, 2026 14:51
@nicolas-grekas nicolas-grekas force-pushed the fix/scheduler-array-arguments-conversion-7.3 branch from 4bdd9fd to 33e0b96 Compare January 8, 2026 14:51
@nicolas-grekas
Copy link
Copy Markdown
Member

Thank you @serhiilabs.

@nicolas-grekas nicolas-grekas merged commit d0f5130 into symfony:6.4 Jan 8, 2026
10 of 11 checks passed
@fabpot fabpot mentioned this pull request Jan 24, 2026
This was referenced Jan 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants