Non-UTF-8 source text (Latin-1 CSS/JS/HTML without charset) fails import: 'Runtime declaration payload is not serializable'

オープン
#7,579 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
52/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
php
領域
backend

調査の方向性

Start with artifact intake and the referenced paths src/ArtifactCompiler/RuntimeDeclarations.php:576, src/ArtifactCompiler/StagedTransport.php:895, and ThemeScaffold.php:22; trace where HTML, CSS, JS, JSON, and SVG bytes enter the plan. Check how HTML charset metadata is currently handled, then reproduce the listed cases and verify that declared encodings and invalid UTF-8 input are normalized as expected. Done means all four reported cases compile and runtime declaration serialization succeeds.

索引モデルが issue の本文から書いたものです。

説明

Summary

Source text that isn't valid UTF-8 (legacy Latin-1/Windows-1252 sites, uploaded zips) fails the whole import instead of being decoded.

Production: two sessions on 2026-11-28 (SSI 1.39.12, upload sources) failed with:

InvalidArgumentException: Runtime declaration payload is not serializable.
at src/ArtifactCompiler/RuntimeDeclarations.php:576 <- :564 <- src/ArtifactCompiler/StagedTransport.php:895

Repro (trunk, ArtifactCompiler::compile)

Each case has one index.html with a single Latin-1 byte (\xE9) somewhere:

case result
Latin-1 byte in a linked s.css JsonException: Malformed UTF-8 characters @ ThemeScaffold.php:22 (uncaught)
Latin-1 byte in a linked a.js failed: wordpress_site_plan_not_self_contained, "Runtime declaration payload is not serializable."
Latin-1 bytes in HTML text and an inline <script>, no charset meta failed: same diagnostic
Same HTML with <meta charset="iso-8859-1"> success_with_warnings

So the HTML path already decodes when a charset is declared. CSS, JS, and undeclared HTML pass raw non-UTF-8 bytes into the plan, and the JSON encoding of runtime declarations, digests and the theme scaffold rejects them.

Expected

Text artifacts (HTML, CSS, JS, JSON, SVG) are normalized to UTF-8 once, at artifact intake. Use the declared encoding where there is one (<meta charset>, CSS @charset, a BOM). Otherwise, for bytes that aren't valid UTF-8, fall back to Windows-1252, a superset of Latin-1 that matches browser behavior for undeclared legacy pages. Everything downstream can then keep assuming UTF-8, and all four cases above compile.

主要言語
PHP
スター
31
フォーク
7
平均マージ
7時間 50分
マージ済み PR(30日)
822

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Automattic/blocks-engine のほかの issue

Automattic/blocks-engine の issue をすべて見る

似ている issue

PHP の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。