Skip to content

Commit 4d13cb8

Browse files
Replace "use-by-ref" by static vars when possible in closures
1 parent 25e5f86 commit 4d13cb8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Process.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1480,8 +1480,6 @@ private function doSignal(int $signal, bool $throwException): bool
14801480
private function prepareWindowsCommandLine(string $cmd, array &$env): string
14811481
{
14821482
$uid = uniqid('', true);
1483-
$varCount = 0;
1484-
$varCache = [];
14851483
$cmd = preg_replace_callback(
14861484
'/"(?:(
14871485
[^"%!^]*+
@@ -1490,7 +1488,9 @@ private function prepareWindowsCommandLine(string $cmd, array &$env): string
14901488
[^"%!^]*+
14911489
)++
14921490
) | [^"]*+ )"/x',
1493-
function ($m) use (&$env, &$varCache, &$varCount, $uid) {
1491+
function ($m) use (&$env, $uid) {
1492+
static $varCount = 0;
1493+
static $varCache = [];
14941494
if (!isset($m[1])) {
14951495
return $m[0];
14961496
}

0 commit comments

Comments
 (0)