10BC0 FIX · symfony/symfony@f4c66cc · GitHub
[go: up one dir, main page]

Skip to content

Commit f4c66cc

Browse files
committed
FIX
1 parent 476787e commit f4c66cc

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

src/Symfony/Component/Config/Definition/Loader/DefinitionFileLoader.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ public function load(mixed $resource, ?string $type = null): mixed
4444
$this->container?->fileExists($path);
4545

4646
// the closure forbids access to the private scope in the included file
47-
$load = \Closure::bind(static fn ($file) => include $file, null, null);
47+
$load = \Closure::bind(static function ($file) use ($loader) {
48+
return include $file;
49+
}, null, null);
4850

4951
$callback = $load($path);
5052

@@ -99,3 +101,5 @@ private function callConfigurator(callable $callback, DefinitionConfigurator $co
99101
final class ProtectedDefinitionFileLoader extends DefinitionFileLoader
100102
{
101103
}
104+
105+
// @php-cs-fixer-ignore use_arrow_functions to prevent arrow function overriding callback that includes file in limited context, ref https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/9388

src/Symfony/Component/DependencyInjection/Loader/PhpFileLoader.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ class_alias(AppReference::class, App::class);
5454
}
5555

5656
// the closure forbids access to the private scope in the included file
57-
$load = \Closure::bind(static fn ($path, $env) => include $path, null, null);
57+
$load = \Closure::bind(static function ($path, $env) use ($container, $loader, $resource, $type) {
58+
return include $path;
59+
}, null, null);
5860

5961
$instanceof = $this->instanceof;
6062
$this->instanceof = [];
@@ -205,3 +207,5 @@ private function callConfigurator(callable $callback, ContainerConfigurator $con
205207
}
206208
}
207209
}
210+
211+
// @php-cs-fixer-ignore use_arrow_functions to prevent arrow function overriding callback that includes file in limited context, ref https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/9388

src/Symfony/Component/Routing/Loader/PhpFileLoader.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ class_alias(RoutesReference::class, Routes::class);
4747

4848
// the closure forbids access to the private scope in the included file
4949
$loader = $this;
50-
$load = \Closure::bind(static fn ($file) => include $file, null, null);
50+
$load = \Closure::bind(static function ($file) use ($loader) {
51+
return include $file;
52+
}, null, null);
5153

5254
if (1 === $result = $load($path)) {
5355
$result = null;
@@ -81,3 +83,5 @@ protected function callConfigurator(callable $callback, string $path, string $fi
8183
return $collection;
8284
}
8385
}
86+
87+
// @php-cs-fixer-ignore use_arrow_functions to prevent arrow function overriding callback that includes file in limited context, ref https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/9388

0 commit comments

Comments
 (0)
0