Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Using the word new somewhere (String, variable part, a.s.o) inside a Volt component can cause render problems.

Aperta
#155 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
laravel, php
Ambito
backend

Direzione di ricerca

Inizia ispezionando il renderer Volt responsabile dell’iniezione della funzione di vista di ritorno, quindi riproduci il problema con i tre frammenti di componenti riportati in questo report. Traccia come la parola "new" nelle regole, nel testo renderizzato e nei nomi delle variabili modifica il PHP generato; il lavoro è completato quando questi esempi vengono renderizzati senza PHP malformato o eccezioni.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Volt Version

1.10.5

Laravel Version

4.3.3

PHP Version

8.2

Database Driver & Version

No response

Description

As soon as the word "new" appears in certain places of the volt component, the rendering gets weird.

I show 3 examples, but I had even more issues. I guess they all point to the same problem.

I upgraded from Livewire 3 to 4 and I do have numerous Volt components in my project. Quite a few are affected by this bug.

Steps To Reproduce
1. Example
  rules([
     'count' => ['required', 'int', 'min:1', 'max:1000', new \App\Rules\GhpRule],
     'gift' => ['boolean'],
  ]);

becomes by the volt renderer

  rules([
     'count' => ['required', 'int', 'min:1', 'max:1000', return new \App\Rules\GhpRule],
     'gift' => ['boolean'],
  ]);

Which gives an exception.

2. Example

THIS DOES cause a render problem:

<?php

use function Livewire\Volt\{state,on,computed};

state([
   'new_count' => false,
]);

?>

<div x-data>
   <x-svg-icon title="{{ 'Previous new contribution' }}" class="{{ $new_count ? '' : 'opacity-30' }}" icon="up"/>
</div>


THIS DOES NOT cause the render problem:

<?php

use function Livewire\Volt\{state,on,computed};

state([
'new_count' => false,
]);

?>

<div x-data>
<x-svg-icon title="{{ 'Previous contribution' }}" class="{{ $new_count ? '' : 'opacity-30' }}" icon="up"/>
</div>

All that I had to change was to change Previous new contribution to Previous contribution !

The render problem is that the return view function is injected inside the last php function found in the volt component. Which causes an exception at the protected keyword.

3. Example

$new = computed(fn() => $this->forumThread);
becomes by the volt renderer

return new = computed(fn() => $this->forumThread);
Which then throws an exception or course.

When I change this to:

$newThread = computed(fn() => $this->forumThread);
everything works.

Lingua principale
PHP
Stelle
422
Fork
35
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di livewire/volt

Tutte le issue di livewire/volt

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.