Blade is not rendering the views, which are displayed as raw php. #52382
Replies: 17 comments 59 replies
-
After many hours of testing and after seeing that a fresh installation of Laravel 11 also failed, I modified the container, based on Alpine 3.20 and PHP 8.3, to use version 8.2, and it started working again. Something changed this morning in Alpine's PHP 8.3 libraries, particularly FPM, which completely broke the application and seems to be causing these issues. Since it does not seem to be related to the framework, I kindly ask you to CLOSE THE ISSUE and accept my apologies. As soon as things here return to normal, I will try to gather more information (if possible) in case it is of interest. Even so, if anyone is curious and requests more information, I will try to provide it. Thank you all, |
Beta Was this translation helpful? Give feedback.
-
If this happens again, upon updating PHP's version, try running these commands: composer dump-autoload
php artisan optimize:clear |
Beta Was this translation helpful? Give feedback.
-
Hi @rodrigopedra, Thanks for the reply. I tried everything, also clearing all caches but it finally seems to be a problem in the alpine FPM package for PHP 8.3, at least with the configuration I use. I am preparing a docker image to reproduce the error and pass the issue to the package maintainer. Thanks again. |
Beta Was this translation helpful? Give feedback.
-
Wow, I created a couple of images (PHP 8.2 and 8.3) this weekend to try to reproduce the error with an empty Larevel 11 project, but I couldn't reproduced it. I will try PHP 8.3 with our application again to see if the issue with the package, I believe it's FPM, has disappeared as suddenly as it appeared. |
Beta Was this translation helpful? Give feedback.
-
I have the same problem, but my config are: php 8.3.8, npm 10.2.4, node 20.11.1 and composer 2.7.1 |
Beta Was this translation helpful? Give feedback.
-
Maybe the problem is with the OpCache. We have the same problem and disabling opcache seems to be working |
Beta Was this translation helpful? Give feedback.
-
@JesusRodriguezAcosta @luizboaretto Did you ever get to this bottom of this? I have the same issue which is intermittent on 6 different codebases. Not using Docker, or Alpine, just standard PHP 8.3 FPM. I've tried clearing OPCache and changing PHP Versions to 8.2 (as well as clearing everything in php artisan and composer) with no luck. Only thing that's worked for me was adding a random space to a view and redeploying. This makes me think it's still OPCache maybe. |
Beta Was this translation helpful? Give feedback.
-
I'm getting the same issue right now on a freshly installed Laravel 11.x, I believe it's an 11.x issue because 10.x works fine Blade directives such as @include, and @content are printed plain on the pages, and views are not processed. |
Beta Was this translation helpful? Give feedback.
-
My advice is to have a base image with all dependencies installed so all you have to do is add your code to it when you build the final image.thst way you have always the same versions. See it as a form of package.lock/composer.lock. |
Beta Was this translation helpful? Give feedback.
-
Just had the exact same issue and searched for hours. |
Beta Was this translation helpful? Give feedback.
-
I'm also having this issue with php8.3 in a fresh Laravel project. |
Beta Was this translation helpful? Give feedback.
-
My investigation on thisSo I have experienced this issue a couple of times now, and again today. Without us actively doing anything on the server, but possibly automatic minor patches are performed, i'm not certain. I've debugged the issue quite a bit, and figured somethings out. I've focused my attention mainly on
Summary / Short-term solution?We've figured out that simply restarting the php-fpm service resolves this issue, and it doesn't seem to come back quickly, we've had it come back maybe once or twice a year on just the one project. This also explains why some of you can't reproduce the issue after having fiddled a bit with your php service, likely you've restarted it at somepoint, fixing the incorrect constant values. Sadly because the issue is on a used application I couldn't continue my investigation for too long and had to opt to resolve it by the above method with no means to further reproduce the issue. If anybody finds the actual root cause behind this constant suddenly working incorrectly i'd love to hear it! |
Beta Was this translation helpful? Give feedback.
-
V8 vs V11 but prepareStringsForCompilationUsing function is never called from the framework so this is a dead end. There are a few other changes between these 2 versions and taking into account that the issue appears only in v11 might be a good starting place. |
Beta Was this translation helpful? Give feedback.
-
Update from our devops team:
For non Docker environment, if the PHP-FPM service isn’t restarted after an update, lingering old processes (from 8.3.8) could still be running, even though the new binary (8.3.9) is installed. This could explain unexpected behavior, especially if certain values or behaviors change between minor versions. |
Beta Was this translation helpful? Give feedback.
-
Another idea. |
Beta Was this translation helpful? Give feedback.
-
Issue created php/php-src#18067 on php. |
Beta Was this translation helpful? Give feedback.
-
Getting this error on PHP 8.3.20, Laravel 11, using Apache PHP, not PHP-FPM. I am not even using Blade for this request!
Nothing seems to fix this issue. Edit:
didn't change anything for the first time. Running it again helped to clear the error/bug. |
Beta Was this translation helpful? Give feedback.
-
Laravel Version
11.x
PHP Version
8.3.9
Database Driver & Version
No response
Description
A few days ago, we updated Laravel and PHP to the latest available versions. Everything went great until this morning when the views stopped working in our last build. Since then, we were not able to put it working again.
Apparently, Blade is not "processing" the views, which are displayed in as raw php.
So, what you see in the HTML is like:
I have no idea why it was working yesterday and not today. I expent several but nothing worked. I also found out that if I compile the views, some of them are displayed, but the error pages produce another error. It’s really strange.
Upon inspecting the cached views at runtime within "storage," it is clear that Blade directives are indeed not being processed. However, if I run php artisan view:cache, they are processed correctly.
I also downgrade to 10, but still the same issue with blade.
EDITED; I tried with a clean installation of Laravel 11 and still getting the same problem, so it looks something related with the container (alpine 3.20 with some extensions).
The error shown:
Undefined variable $component (View: /var/www/app/vendor/laravel/framework/src/Illuminate/Foundation/resources/exceptions/renderer/show.blade.php)
@component('Illuminate\View\AnonymousComponent', 'laravel-exceptions-renderer::layout', ['view' => 'laravel-exceptions-renderer::components.layout','data' => ['exception' => $exception]])<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?><?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?><?php endif; ?><?php $component->withAttributes(['exception' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($exception)]); ?> <div class="renderer container mx-auto lg:px-8">@component('Illuminate\View\AnonymousComponent', 'laravel-exceptions-renderer::navigation', ['view' => 'laravel-exceptions-renderer::components.navigation','data' => ['exception' => $exception]])<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?><?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?><?php endif; ?>
I've tried with Alpine Edge and PHP 8.3.10 and the same error occurs. Does anyone have any idea what might be happening?
Steps To Reproduce
No idea.
Beta Was this translation helpful? Give feedback.
All reactions