Captured slideshow pass overwrites the route path, aborting compose with a rebind() TypeError

Aperta Adatta ai principianti
#5,003 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

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

Direzione di ricerca

Inizia in CapturedDialogProjector.php, nel passaggio della presentazione acquisita, in particolare nei cicli interni che riutilizzano $path e nelle chiamate successive a $retired[$path] e $bindings->rebind($files, $path). Rinomina le variabili interne affinché il percorso della route rimanga fisso per ogni iterazione della pagina. Il lavoro è completato quando i media mancanti continuano a essere gestiti con il comportamento esistente di $missing e compose termina senza il TypeError di rebind() né registrare la chiave del file errata.

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

Descrizione

Summary

In CapturedDialogProjector's captured-slideshow pass (added in #3811), the outer loop variable $path holds the route's HTML file path. Two inner loops reuse the same name and overwrite it:

  • $path = $assets[$media['asset'] ?? ''] ?? null; sets it to null when a frame's media asset was not captured.
  • foreach (array_slice($paths, $used) as $path) sets it to a relative image path.

After the page changes, the pass calls $retired[$path] = … and $bindings->rebind($files, $path) with the overwritten value:

  • null aborts the whole compose: TypeError: ScriptOccurrenceBindings::rebind(): Argument #2 ($sourcePath) must be of type string, null given (CapturedDialogProjector.php:218).
  • An image path silently rebinds scripts and records retired runtimes under the wrong file key.

Reproduction

A real Square Online store (an import from www.braveyogimedicinals.com) fails with the TypeError above on php-transformer v0.45.312 (SSI v1.33.426, DLA v0.33.168). Any page with a captured carousel/slideshow component whose frame references a media asset that is missing from the asset map, alongside a frame that still gets materialized, reproduces the bug.

Expected

The route file path stays fixed for the whole page iteration. A frame with an uncaptured asset is reported as missing (existing $missing behavior), and compose completes.

Fix

Rename the inner variables (for example $assetPath and $extraPath) so the outer $path is never reassigned.

AI disclosure: Claude Opus via Pi (Franklin agent) traced this from the failing import and wrote the issue.

Lingua principale
PHP
Stelle
25
Fork
3
Merge medio
2h 23m
PR unite (30g)
942

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 Automattic/blocks-engine

Tutte le issue di Automattic/blocks-engine

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.