Skip to content

Commit

Permalink
[9.x] Fix PHP warnings when rendering long blade string (laravel#41745)
Browse files Browse the repository at this point in the history
  • Loading branch information
a-bashtannik committed Apr 13, 2022
1 parent 83be3c8 commit 43fa222
Show file tree
Hide file tree
Showing 2 changed files with 9 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 @@ -74,7 +74,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
8 changes: 8 additions & 0 deletions tests/Integration/View/BladeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ 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 43fa222

Please sign in to comment.