Skip to content

Commit bfb1774

Browse files
[9.x] Fix PHP warnings when rendering long blade string (#41956) (#41970)
* [9.x] Fix PHP warnings when rendering long blade string (#41745) * Apply fixes from StyleCI (cherry picked from commit bb0da4a) Co-authored-by: Andrew Bashtannik <[email protected]>
1 parent 3c4cc39 commit bfb1774

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/Illuminate/View/Component.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function resolveView()
7575
$resolver = function ($view) {
7676
$factory = Container::getInstance()->make('view');
7777

78-
return $factory->exists($view)
78+
return strlen($view) <= PHP_MAXPATHLEN && $factory->exists($view)
7979
? $view
8080
: $this->createBladeViewFromString($factory, $view);
8181
};

tests/Integration/View/BladeTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@ public function test_rendering_blade_string()
1414
$this->assertSame('Hello Taylor', Blade::render('Hello {{ $name }}', ['name' => 'Taylor']));
1515
}
1616

17+
public function test_rendering_blade_long_maxpathlen_string()
18+
{
19+
$longString = str_repeat('a', PHP_MAXPATHLEN);
20+
21+
$result = Blade::render($longString.'{{ $name }}', ['name' => 'a']);
22+
23+
$this->assertSame($longString.'a', $result);
24+
}
25+
1726
public function test_rendering_blade_component_instance()
1827
{
1928
$component = new HelloComponent('Taylor');

0 commit comments

Comments
 (0)