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

Dataset is not passed to context in StopOnError()

Aperta
#822 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

@vjik ci sta già lavorando.

Dal 25/9/2026.

  • #824 di @vjik — aperta

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
65/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
php

Direzione di ricerca

Look at the StopOnError rule implementation to see how it creates a ValidationContext for its nested rules. The dataset should be passed from the outer context. Check the Callback rule usage in the test suite to understand the expected behavior. Verify the fix by running existing validation tests, especially those involving nested Each and StopOnError.

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

Descrizione

Description

Current scope's dataset is not set in context inside StopOnError():

'property' => [
    new Callback(
        function (mixed $value, Callback $rule, ValidationContext $context): Result {
            $context->getDataSet()->getData(); // <= dataset array
        }
    ),
    new StopOnError([
        new Callback(
            function (mixed $value, Callback $rule, ValidationContext $context): Result {
                $context->getDataSet()->getData(); // <= null (bug)
            }
        ),
    ]),
]

this could be worked around using $context->getGlobalDataSet() and extracting data from there,
but it would be not possible in case if multiple nested Each() used, because in context parameters there is index for the last Each() only

Package version

No response

PHP version

No response

Lingua principale
PHP
Stelle
167
Fork
47
Merge medio
1g 7h
PR unite (30g)
2

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 yiisoft/validator

Tutte le issue di yiisoft/validator

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.