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

Đã đóng Phù hợp với người mới
#5,003 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
78/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
php
Lĩnh vực
backend

Hướng nghiên cứu

Bắt đầu trong CapturedDialogProjector.php tại lượt xử lý trình chiếu đã được ghi lại, đặc biệt là các vòng lặp bên trong dùng lại $path và các lời gọi sau đó tới $retired[$path] và $bindings->rebind($files, $path). Đổi tên các biến bên trong để đường dẫn route được giữ nguyên trong mỗi lần lặp trang. Hoàn tất khi media bị thiếu vẫn được xử lý theo hành vi $missing hiện có và compose hoàn tất mà không gặp TypeError của rebind() hoặc ghi nhận sai khóa tệp.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
PHP
Star
25
Fork
3
Merge trung bình
2 giờ 20 phút
Pull request đã merge (30 ngày)
934

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Automattic/blocks-engine

Tất cả issue của Automattic/blocks-engine

Issue tương tự

Thêm issue về PHP

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.