bug #38544 [DI] fix dumping env vars (nicolas-grekas)
This PR was merged into the 4.4 branch.
Discussion
----------
[DI] fix dumping env vars
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
Forgotten in #35029
For 4.4 to reduce merge conflicts (it doesn't allow the new chars in 4.4 anyway, #35029 is still needed)
Commits
-------
746a8d1a09
[DI] fix dumping env vars
This commit is contained in:
commit
75b3d179f9
@ -1413,7 +1413,7 @@ EOF;
|
|||||||
$export = $this->exportParameters([$value]);
|
$export = $this->exportParameters([$value]);
|
||||||
$export = explode('0 => ', substr(rtrim($export, " ]\n"), 2, -1), 2);
|
$export = explode('0 => ', substr(rtrim($export, " ]\n"), 2, -1), 2);
|
||||||
|
|
||||||
if (preg_match("/\\\$this->(?:getEnv\('(?:\w++:)*+\w++'\)|targetDir\.'')/", $export[1])) {
|
if (preg_match("/\\\$this->(?:getEnv\('(?:[-.\w]*+:)*+\w++'\)|targetDir\.'')/", $export[1])) {
|
||||||
$dynamicPhp[$key] = sprintf('%scase %s: $value = %s; break;', $export[0], $this->export($key), $export[1]);
|
$dynamicPhp[$key] = sprintf('%scase %s: $value = %s; break;', $export[0], $this->export($key), $export[1]);
|
||||||
} else {
|
} else {
|
||||||
$php[] = sprintf('%s%s => %s,', $export[0], $this->export($key), $export[1]);
|
$php[] = sprintf('%s%s => %s,', $export[0], $this->export($key), $export[1]);
|
||||||
@ -1819,7 +1819,7 @@ EOF;
|
|||||||
return $dumpedValue;
|
return $dumpedValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!preg_match("/\\\$this->(?:getEnv\('(?:\w++:)*+\w++'\)|targetDir\.'')/", $dumpedValue)) {
|
if (!preg_match("/\\\$this->(?:getEnv\('(?:[-.\w]*+:)*+\w++'\)|targetDir\.'')/", $dumpedValue)) {
|
||||||
return sprintf('$this->parameters[%s]', $this->doExport($name));
|
return sprintf('$this->parameters[%s]', $this->doExport($name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user