peer_reviewed_article: Saving without the author, title or image field passes null to the DOM (PHP 9.0)
メンテナーはふだん 1 日以内に返信
評価
調査の方向性
Start in system/datatypes/peer_reviewed_article.php at editAction(), around lines 717–725, and compare the optional field handling in festival.php. Check how dataFor() behaves when author, title, or featured image is absent, then confirm saves with those fields omitted no longer pass null to DOM methods. Pull request #602 is already open for this issue.
索引モデルが issue の本文から書いたものです。
説明
Problem. peer_reviewed_article::editAction() passes three form values straight to DOM methods:
system/datatypes/peer_reviewed_article.php:717-718:setAttribute(self::FIELD_NAME_AUTHOR, $form->dataFor(self::FIELD_NAME_AUTHOR)):720:->setText($form->dataFor(self::FIELD_NAME_TITLE)):725:->getOrCreate(self::FIELD_NAME_FEATURED_IMAGE)->setText($form->dataFor(self::FIELD_NAME_FEATURED_IMAGE))
dataFor() returns null for a field that is not in the post (for the featured image: when neither featured_image nor file_shadow_featured_image is posted). Passing null to a string parameter of an internal function is deprecated since PHP 8.1 and becomes a TypeError in PHP 9.0 (RFC: Deprecate passing null to non-nullable arguments of internal functions). On 9.0 such a save ends in a fatal error instead of storing empty values.
Messages on main (d97ab7b), PHP 8.2 and 8.5, for one post to <article>/edit with command save and only text, excerpt, method and sources:
Deprecated: DOMElement::setAttribute(): Passing null to parameter #2 ($value) of type string is deprecated in system/datatypes/peer_reviewed_article.php on line 718
Deprecated: DOMDocument::createTextNode(): Passing null to parameter #1 ($data) of type string is deprecated in system/core/database.php on line 488 (setText(), called from line 720 and 725)
The edit form in a browser always posts these fields (the shadow field of the image is added by HTMLForm::addFileShadowValueField()), so this hits a client that posts fewer fields, such as a script or an older form, not the normal editor. PHP 8.6.0RC4 runs the same code; its Apache image does not show the deprecation in the container log.
This is the same kind of fault as #408 (document.php:566), #588 (festival phone) and the festival website field in #559, in a place those do not cover.
Proposed fix (a suggestion and a starting point): give dataFor() the default '' for these three fields, as festival.php does for its optional fields. Works unchanged on PHP 8.2 up to 8.5.
🤖 Generated with Claude Code
- 主要言語
- JavaScript
- スター
- 5
- フォーク
- 9
- 平均マージ
- 18時間 7分
- マージ済み PR(30日)
- 11
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
PlanBCode/hypha のほかの issue
-
Impact: Medium Level: Easy Type: Bug Value: Users
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
Impact: Low Level: Easy Pagetype: Festival Type: Bug Value: Coders
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
Impact: Medium Level: Easy Pagetype: Mailinglist Type: Bug Value: Users
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
メンテナーはふだん 1 日以内に返信
-
Impact: Low Level: Easy Type: Bug Value: Coders
難易度 1/5 1〜3時間 初心者へのやさしさ 85/100
PlanBCode/hypha#586 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Impact: Medium Level: Easy Type: Bug Usecase: De Stadsbron Value: Visitors
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
PlanBCode/hypha#522 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
PlanBCode/hypha の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
Graphify-Labs/graphify#4860 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
CommandCodeAI/command-code#1088 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
CanadaHonk/porffor#426 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
RIT-Software-Engineering/RIT-SE-Senior-Project#546 ·
メンテナーはふだん 1 日以内に返信