Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.x] Backport Fix PHP warnings when rendering long blade string (#41956) #41970

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Illuminate/View/Component.php
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
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