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

Skip to content

Commit f2e8474

Browse files
bug #58195 [Process] Fix the removal of host-specific configuration when managing the ini settings in PhpSubprocess (M-arcus)
This PR was submitted for the 7.1 branch but it was merged into the 6.4 branch instead. Discussion ---------- [Process] Fix the removal of host-specific configuration when managing the ini settings in `PhpSubprocess` | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | | License | MIT `preg_match` can return the offset needed for `substr` in the next line, but without the flag it doesn't put the offset of the capturing group into `$matches[0][1]` With the example php.ini the code breaks on execution ```ini opcache.validate_timestamps = 0 [HOST=my.test.host] opcache.validate_timestamps = 1 ``` Commits ------- 1ef6bf7 PhpSubprocess: Add flag PREG_OFFSET_CAPTURE to preg_match to identify the offset
2 parents 5df912c + 1ef6bf7 commit f2e8474

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Component/Process/PhpSubprocess.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ private function writeTmpIni(array $iniFiles, string $tmpDir): string
106106
throw new RuntimeException('Unable to read ini: '.$file);
107107
}
108108
// Check and remove directives after HOST and PATH sections
109-
if (preg_match('/^\s*\[(?:PATH|HOST)\s*=/mi', $data, $matches)) {
109+
if (preg_match('/^\s*\[(?:PATH|HOST)\s*=/mi', $data, $matches, \PREG_OFFSET_CAPTURE)) {
110110
$data = substr($data, 0, $matches[0][1]);
111111
}
112112

0 commit comments

Comments
 (0)