Skip to content

fix(document): 複製したリソースの情報詳細画面で出る未定義変数の警告を解消 - #479

Merged
yama merged 1 commit into
mainfrom
fix/474-duplicated-resource-info-warning
Sep 23, 2026
Merged

yama merged 1 commit into
mainfrom
fix/474-duplicated-resource-info-warning

Conversation

@yama

@yama yama commented Sep 22, 2026

Copy link
Copy Markdown
Member

概要

複製したリソースの情報詳細画面(a=3)で Undefined variable $editedbyname の PHP 警告が出る不具合を直します。

原因

複製したリソースは editedby = 0 で作られます。document_data.static.php は編集者のユーザー名が取得できたときだけ $editedbyname を代入しているため、該当ユーザーが無いと未定義のまま参照されていました。$createdbyname も同じ書き方で、作成者のユーザーが削除済みの場合に同じ警告が出ます。

変更内容

  • $createdbyname と $editedbyname を、ユーザー名を取得する前に '' で初期化する

影響範囲

  • 情報詳細画面のみ
  • 編集者が取れない場合は、既存の if ($editedbyname != '') の条件どおり「編集日時」の行を出さない(意図した表示のまま)

確認手順

  1. 既存リソースを複製する
  2. 複製先の情報詳細画面(index.php?a=3&id=<複製先ID>)を開く
  3. PHP 警告が出ず、「作成日時」の行に作成者名が出ることを確認する

1.3.0rc1 を新規インストールしたローカル環境で、修正前は警告が出て、修正後は出ないことを確認しました。

Closes #474

🤖 Generated with Claude Code

https://claude.ai/code/session_01715QYq9MrhezVezp8WXJs6

複製したリソースは editedby=0 で作られるため編集者のユーザー名が
取得できず、$editedbyname が未定義のまま参照されて警告が出ていた。
作成者・編集者名の変数を空文字で初期化する。

Closes #474

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01715QYq9MrhezVezp8WXJs6
@coderabbitai

coderabbitai Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository: modxcms-jp/evolution-jp/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 09dccf73-a685-45f1-8ae8-7cbf4e1b8f92

📥 Commits

Reviewing files that changed from the base of the PR and between 3682ff5 and 0ac7c74.

📒 Files selected for processing (1)
  • manager/actions/document/document_data.static.php

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@yama
yama marked this pull request as ready for review September 23, 2026 00:03
Copilot AI lite review requested due to automatic review settings September 23, 2026 00:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The fix resolves the warnings while preserving existing display behavior.

Review effort: Lite
Findings: None

What changed in this PR

Fixes undefined-variable warnings on the resource details page for cloned resources.

Changes:

  • Initializes $createdbyname and $editedbyname to empty strings.
  • Preserves existing display conditions when user data is unavailable.
File Description
manager/​actions/​document/​document_data.static.php Adds defaults for creator and editor name variables.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@yama
yama merged commit d7c998b into main Sep 23, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

複製したリソースの情報詳細画面で Undefined variable $editedbyname の警告が出る

2 participants