diff --git a/src/Illuminate/View/Component.php b/src/Illuminate/View/Component.php index 402a13abdc5..8acf9a7f874 100644 --- a/src/Illuminate/View/Component.php +++ b/src/Illuminate/View/Component.php @@ -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); }; diff --git a/tests/Integration/View/BladeTest.php b/tests/Integration/View/BladeTest.php index 9f3717c4d81..b3d8f51eedc 100644 --- a/tests/Integration/View/BladeTest.php +++ b/tests/Integration/View/BladeTest.php @@ -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');