Skip to content

Blade::render issues since 9.36.0-2 #44646

@nuernbergerA

Description

@nuernbergerA
  • Laravel Version: 9.36.2
  • PHP Version: 8.1.11

Description:

  1. run the whole file, the last test will fail with InvalidArgumentException : No hint path defined for [__components].
  2. running only the will fail test will create a invalid blade file and fail with Illuminate\View\ViewException : syntax error, unexpected token "endif", expecting end of file
<?php $__env->startComponent('SomeElement', 'some-element', []); ?>
<?php if (isset($attributes) && $constructor = (new ReflectionClass(SomeElement::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?> <?php /** THERE IS NO OPEN IF **/ ?>
<?php if (isset($__componentOriginal0cbfd81d34ff16f0868c01a1a16dfeb994e92c1e)): ?>
<?php $component = $__componentOriginal0cbfd81d34ff16f0868c01a1a16dfeb994e92c1e; ?>
<?php unset($__componentOriginal0cbfd81d34ff16f0868c01a1a16dfeb994e92c1e); ?>
<?php endif; ?><?php /**PATH /.../storage/framework/views/1f84f403095fcf086e9a69cc809736581405d651.blade.php ENDPATH**/ ?>

Steps To Reproduce:

Create a Pest Test File

<?php

use Illuminate\Support\Facades\Blade;
use Illuminate\View\Component;

class SomeElement extends Component
{
    public function render()
    {
        return '<div></div>';
    }
}

it('works', function() {
    Blade::renderComponent(new SomeElement);
    $this->assertTrue(true);
});

it('will fail', function() {
    Blade::component(SomeElement::class, 'some-element');
    Blade::render('<x-some-element />');
    $this->assertTrue(true);
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions