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

Open Beginner friendly
#5,003 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
php
Domain
backend

Research direction

Start in CapturedDialogProjector.php at the captured-slideshow pass, especially the inner loops that reuse $path and the later $retired[$path] and $bindings->rebind($files, $path) calls. Rename the inner variables so the route path remains fixed for each page iteration. Done when missing media stays handled by the existing $missing behavior and compose completes without the rebind() TypeError or recording the wrong file key.

Written by the indexing model from the issue text.

Description

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.

Dominant language
PHP
Stars
25
Forks
3
Avg merge
2h 23m
Merged PRs (30d)
942

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Automattic/blocks-engine

All issues in Automattic/blocks-engine

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.