Skip to content

Commit

Permalink
[9.x] Fix PHP warnings when rendering long blade string (#41956) (#41970
Browse files Browse the repository at this point in the history
)

* [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 <bashtannik@gmail.com>
  • Loading branch information
BrandonSurowiec and a-bashtannik authored Apr 14, 2022
1 parent 3c4cc39 commit bfb1774
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Illuminate/View/Component.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function resolveView()
$resolver = function ($view) {
$factory = Container::getInstance()->make('view');

return $factory->exists($view)
return strlen($view) <= PHP_MAXPATHLEN && $factory->exists($view)
? $view
: $this->createBladeViewFromString($factory, $view);
};
Expand Down
9 changes: 9 additions & 0 deletions tests/Integration/View/BladeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ public function test_rendering_blade_string()
$this->assertSame('Hello Taylor', Blade::render('Hello {{ $name }}', ['name' => 'Taylor']));
}

public function test_rendering_blade_long_maxpathlen_string()
{
$longString = str_repeat('a', PHP_MAXPATHLEN);

$result = Blade::render($longString.'{{ $name }}', ['name' => 'a']);

$this->assertSame($longString.'a', $result);
}

public function test_rendering_blade_component_instance()
{
$component = new HelloComponent('Taylor');
Expand Down

0 comments on commit bfb1774

Please sign in to comment.