prettier / prettier/plugin-php
Invalid output caused by combo of if statement, inline node, and comment
まだ誰も着手していません。
- 主要言語
- PHP
- スター
- 1.9k
- フォーク
- 139
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
Input:
<?php
if (true) {
?>inline<?php
// comment
}
Output:
<?php
if (true) { ?>inline<?php
// comment
// comment
?>}
Note the extra closing tag that has been added, which makes the code invalid, and that the comment is duplicated, which is unexpected.
If you comment out this line, it doesn't print out the closing tag that breaks the code, but it also removes the closing tag from the test file inline3.php.
If you comment out the line above, prettier throws the following error, I think about inline3.php again.
Comment "// test" was not printed. Please report this error!
I've tried to debug, but the printing system is quite large. I'll still keep looking, but might as well put it out to the community too!
Problem aslo with
<!DOCTYPE html>
<html lang="de">
<head>
<?php /* ups */
if (1==1)
{
echo 'FOO';
} ?>
</head>
<body>
</body>
</html>
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
src/printer.js の 1362-1363 行付近から始め、提示された PHP ケースを再現します。出力を tests/comments/inline3.php と比較し、特に inline の閉じタグの動作を確認します。formatter が必要な閉じタグを保持し、無効な追加タグを付加したりコメントを重複させたりせず、既存の inline3.php の期待値も引き続き有効であれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- php
- 領域
- tooling
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100