Skip to content

Commit

Permalink
[9.x] Fix PHP warnings when rendering long blade string (#41956)
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
  • Loading branch information
a-bashtannik committed Apr 13, 2022
1 parent 560d2a7 commit bb0da4a
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 @@ -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
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 bb0da4a

Please sign in to comment.