Old input values get lost within fields-loop

Ouverte
#16,027 2 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

@andjsch y travaille déjà.

Depuis le 24/11/2026.

  • #16028 par @andjsch — ouverte

Évaluation

Difficulté
3/5
Temps estimé
1-2 jours
Accessibilité débutants
50/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Active
Stack technique
laravel, php
Domaine
backend

Piste de recherche

Reproduce with the snippet from the report: form:create exposes old as the full array, and the fields tag with scope="field" should narrow it to the current field's value but returns null instead. Locate the form:create and fields tag implementations and see how old is added to the cascade versus how the loop builds its scoped context. The regression appeared between 6.42 and 6.44, so diff that range; done looks like {{ old }} printing the current field's previous value inside the loop while still being the array outside it.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

forms
Bug description

After upgrading from 6.42 to 6.44 I noticed, that input values from previous inputs (old variable) aren't available within the fields loop.

{{ old }} is always null within a field. So something like the below won't work.

<!-- /vendor/statamic/forms/fields/default.antlers.html -->
<input {{ old ?= 'value="{old}"' }} />
<!-- End: /vendor/statamic/forms/fields/default.antlers.html -->
How to reproduce

Before we are within the fields loop, old outputs the whole array of values. Within the loop, old become null whilst it should be the value of the field we are looping.

{{ form:create :in="form:handle ?? form_handle" js="alpine:form" attr:x-ref="form" }}
  {{ old | dump }} ===> THIS WORKS as intended: array of all values
  {{# Render various form sections. #}}
  {{ sections }}
    {{ old | dump }} ===> STILL WORKS: array
      {{# Render the default-styled fields. #}}
      {{ fields scope="field" }}
        {{ old | dump }} ===> DOESNT WORK: old is null instead of the value of the current field
      {{ /fields }}
  {{ /sections }}
{{ /form:create }}

### Logs

```shell

Environment
Environment
Laravel Version: 13.44.1
PHP Version: 8.5.12
Composer Version: 2.10.0
Environment: local
Debug Mode: ENABLED
Maintenance Mode: OFF
Timezone: Europe/Vienna
Locale: de

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: NOT CACHED

Drivers
Broadcasting: log
Cache: file
Database: mysql
Logs: stack / daily
Mail: smtp
Queue: database
Session: file

Storage
public/storage: NOT LINKED

Locales
Installed: de, en, sk
LaravelLang\Lang\Plugin: 15.39.2
Locales Version: 2.11.0
Protected: de, en
Publisher Version: 16.9.0

Livewire
Livewire: v4.4.10

Statamic
Addons: 8
License Key: Set
Sites: 3 (Deutsch, English, Slovak)
Stache Watcher: Enabled (auto)
Static Caching: Disabled
Version: 6.44.0 PRO

Statamic Addons
marcorieser/statamic-livewire: 6.0.0-beta.1
rias/statamic-redirect: 4.2.5
schantldev/statamic-newsletter: 6.x-dev
schantldev/statamic-phosphoricons: 2.0.1
spatie/statamic-responsive-images: 6.2.0
stillat/meerkat: 4.0.2
studio1902/statamic-peak-seo: 11.9.6
studio1902/statamic-peak-tools: 9.2.3
Installation

Existing Laravel app

Additional details

No response

Langage dominant
PHP
Étoiles
4.9k
Forks
647
Merge moyen
1 j 45 min
PR mergées (30 j)
221

Préparer son environnement

Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de statamic/cms

Toutes les issues de statamic/cms

Issues similaires

Plus d'issues PHP

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.