Skip to content

Commit d4cb395

Browse files
committed
Add use input to the pattern function
1 parent 6055372 commit d4cb395

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/ExpressionLanguage/File.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public function __construct(string $name)
1414
$name,
1515
function (string $value): string {
1616
$pattern = <<<'PHP'
17-
(function () {
17+
(function () use ($input) {
1818
$resource = \tmpfile();
1919
if ($resource === false) {
2020
throw new \RuntimeException('Could not open temporary file.');

src/ExpressionLanguage/TemporaryFile.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ public function __construct(string $name)
1414
$name,
1515
function (string $value): string {
1616
$pattern = <<<'PHP'
17-
(function ($data) {
17+
(function ($data) use ($input) {
1818
if (!is_string($data)) {
1919
return null;
2020
}
2121
$stream = fopen('php://temp', 'r+');
2222
fwrite($stream, $data);
2323
fseek($stream, 0, SEEK_SET);
2424
return $stream;
25-
})(%s);
25+
})(%s)
2626
PHP;
2727

2828
return sprintf($pattern, $value);

0 commit comments

Comments
 (0)