Skip to content

Commit

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

* Apply fixes from StyleCI

(cherry picked from commit bb0da4a)
  • Loading branch information
a-bashtannik authored and BrandonSurowiec committed Apr 14, 2022
1 parent 3c4cc39 commit d04f17c
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
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

0 comments on commit d04f17c

Please sign in to comment.