Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

A database password with a quote or a backslash breaks wp-tests-config.php

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

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

@ekamran がすでに取り組んでいます。

2026年10月12日 から。

  • #355 @ekamran による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
php
領域
testing, tooling

調査の方向性

Start by reading prepare.php where it writes wp-tests-config.php, then compare its value escaping with wp-admin/setup-config.php as described in the issue. Check the generated config with quote, backslash, and localhost-containing values, and verify that the table prefix is handled too. Done means generated settings preserve the supplied values and the test run and cleanup can read the config; a pull request is already open.

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

説明

prepare.php writes WPT_DB_NAME, WPT_DB_USER, WPT_DB_PASSWORD and WPT_DB_HOST into single-quoted PHP strings in wp-tests-config.php without escaping them.

I ran the config-writing code of prepare.php on master (61491cb) with a few passwords:

WPT_DB_PASSWORD Result in wp-tests-config.php
p'q"r$s#t u Parse error on line 42
endswith\ Parse error on line 43
two\\back No error, but DB_PASSWORD is two\back
my-localhost-pw No error, but DB_PASSWORD is my-127.0.0.1:33348-pw

The last one happens because the placeholders are replaced one after another with str_replace(), so the localhost placeholder also matches inside the password that was written a step earlier.

The same escaping problem applies to WPT_TABLE_PREFIX, which is written into $table_prefix in the generated config.

With the parse error, the test run fails, and cleanup-db.php cannot read the settings, so the test tables stay in the database. Randomly generated passwords can contain these characters.

WordPress escapes these values with addcslashes( $value, "\\'" ) when it writes wp-config.php in wp-admin/setup-config.php. I have a fix with a CI check and will open a pull request.

主要言語
PHP
スター
77
フォーク
79
平均マージ
4日 19時間
マージ済み PR(30日)
3

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

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

WordPress/phpunit-test-runner のほかの issue

WordPress/phpunit-test-runner の issue をすべて見る

似ている issue

PHP の issue をもっと見る

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

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