POST site search forms (e.g. CMS search blocks) are not core/search; on /giving pages they classify as donation and fail the import

未关闭
#6,503 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
68/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
php, wordpress
领域
backend, web-dev

调研方向

Read SearchBlockConverter::searchBlockFromForm() and FormRuntimeRequirementAnalyzer::intent(), then compare their search signals with SearchBlockConversionContext::hasSearchFormSignal(). Trace the existing tests for POST search forms and donation detection. Done means qualifying POST searches become core/search, including on giving pages, while real donation forms remain classified as donations.

由索引模型根据 Issue 内容生成。

描述

Summary

A site search form that submits with method="post" is not recognized as search. This is common with CMS search blocks such as Drupal's search-block-form. On a page whose action path looks like a donation URL (/giving, /donate), the same form is classified as a donation form.

Results:

  • On most pages, FormRuntimeRequirementAnalyzer::intent() returns unknown, and the single text field counts as contact evidence. SSI then materializes the header search as a Jetpack contact form, so a visitor's search becomes a feedback submission.
  • On /giving/ the intent is donation, jetpack/donations refuses it (donation_amounts_unrecognized), and the form stays a core/html fallback. That fails the import quality gate, so the whole import fails.

Production: https://physics.uci.edu/ (static_site_capture_build_failed). After working around https://github.com/Automattic/static-site-importer/issues/3097 locally, the import fails with static_site_importer_quality_failed: 1 unsupported_html_fallback, which is the header search on /giving/.

Reduced reproduction (neutral)

index.html and giving/index.html both have this in <header>, with action set to the page's own path:

<form action="/giving" method="post" id="search-block-form" accept-charset="UTF-8"><div class="container-inline">
  <h2 class="element-invisible">Search form</h2>
  <div class="form-item"><label class="element-invisible" for="edit-search">Search </label>
  <input title="Enter the terms you wish to search for." type="text" id="edit-search" name="search_block_form" value="" size="15" maxlength="128" class="form-text"></div>
  <div class="form-actions"><input type="submit" id="edit-submit" name="op" value="Search" class="form-submit"></div>
  <input type="hidden" name="form_build_id" value="form-abc123"><input type="hidden" name="form_id" value="search_block_form">
</div></form>

studio create --from <dir> (SSI 1.34.137) fails with static_site_importer_quality_failed: 1 unsupported_html_fallback, 1 core_html_block. The home page content holds jetpack/contact-form + jetpack/field-text + two jetpack/field-hidden.

Root cause

  1. SearchBlockConverter::searchBlockFromForm() returns null for any non-GET method, even though core/search replaces the source's search handler entirely. The source method has no bearing on the WordPress result.
  2. FormRuntimeRequirementAnalyzer::intent() checks $donate (set from the path regex give|giving|donat…) before search. Its search signal is also narrower than SearchBlockConversionContext::hasSearchFormSignal(): it only accepts the form's role=search, an input with type=search, or names q/s/search/query, and only for GET.

Expected

A form with one free-text input, one submit, and only hidden server tokens besides those becomes core/search regardless of method, provided hasSearchFormSignal() holds (here id="search-block-form" and the "Search" submit). The intent analyzer should agree, reporting search ahead of the path-only donation rule. A real donation form (amount choices, or a Donate/Give submit) must still be classified as donation.

主要语言
PHP
星标
28
派生
5
平均合并
2 小时 53 分钟
30 天内合并 PR
938

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Automattic/blocks-engine 的其他 Issue

查看 Automattic/blocks-engine 的全部 Issue

相似的 Issue

更多 PHP Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。