Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEP Allow symfony 4 #301

Merged

Conversation

emteknetnz
Copy link
Member

Copy link
Contributor

@maxime-rainville maxime-rainville left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Process constructor now only accepts an array. Passing the command as a string will throw a deprecation warning.

@emteknetnz
Copy link
Member Author

emteknetnz commented Dec 2, 2021

Updated it to pass an array

symfony 3 array|string
https://github.com/symfony/process/blob/3.4/Process.php#L135

symfony 4 array
https://github.com/symfony/process/blob/4.4/Process.php#L132

How symfony 3 handles arrays (implodes them)
https://github.com/symfony/process/blob/3.4/Process.php#L285

@@ -100,7 +100,7 @@ protected function processGroup(
$logger->info("Running '$cmd'");

// Execute script via shell
$process = new Process($cmd);
$process = new Process([$cmd]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Symphony doc says to pass the parameters as array entries:

$process = new Process(['ls', '-lsa']);

So it probably needs to be something like this:

Suggested change
$process = new Process([$cmd]);
$process = new Process([
$scriptTask,
"index={$indexClassEscaped}",
"class={$class}",
"group={$group}",
"groups={$groups}",
"variantstate={$statevar}",
"verbose=1"
]);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes agree that would be better, have updated

Copy link
Contributor

@maxime-rainville maxime-rainville left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally with both symfony 3 and 4. Works great.

@maxime-rainville maxime-rainville merged commit 5611e24 into silverstripe:3.9 Dec 10, 2021
@maxime-rainville maxime-rainville deleted the pulls/3.9/symfony4 branch December 10, 2021 02:57
@GuySartorelli
Copy link
Member

@maxime-rainville Heya, just wondering if this got tested in dev mode, as well as test/live mode? I'm having an issue at the moment after an update that includes updating symfony from 3 to 4 - in dev mode the processes don't seem to be run, though replacing that with shell_exec does work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants