I have a Laravel 9 (latest) site which is throwing an exception when rendering core 404 blade.
Exception: htmlspecialchars(): Argument #1 ($string) must be of type string, _ given .../var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/404.blade.php
404.blade.php
@extends('errors::minimal')
@section('title', __('Not Found'))
@section('code', '404')
@section('message', __('Not Found'))
If I change __('Not Found') to 'Not Found', the exception is not thrown and the 404 page renders correctly.
This is not an issue on my local environment, but I'm using the same PHP version 8.1.22.
UPDATE: Trace...
#0 /var/app/current/vendor/laravel/framework/src/Illuminate/Support/helpers.php(123): htmlspecialchars(Object(_), 3, 'UTF-8', true)
#1 /var/app/current/vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesLayouts.php(53): e(Object(_))
#2 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/404.blade.php(3): Illuminate\\View\\Factory->startSection('title', Object(_))
#3 /var/app/current/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(109): require('/var/app/curren...')
#4 /var/app/current/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(110): Illuminate\\Filesystem\\Filesystem::Illuminate\\Filesystem\\{closure}()
#5 /var/app/current/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php(58): Illuminate\\Filesystem\\Filesystem->getRequire('/var/app/curren...', Array)
TIA
__('Not Found')for translation? Why not use a variable in blade?@php $not_found = __('Not Found'); @endphp @section('title', $not_found)