sscanf(): Bad scan conversion character "."
オープン
まだ誰も着手していません。
Bug
Extension: standard
Status: Needs Triage
- 主要言語
- C
- スター
- 40.4k
- フォーク
- 8.2k
- 平均マージ
- 2日 13時間
- マージ済み PR(30日)
- 96
説明
Description
The following code:
<?php
$format = 'only %d - %.1f';
printf($format, 1, 2);
$str = sprintf($format, 1, 2);
sscanf($str, $format, $low, $max);
Resulted in this output:
only 1 - 2.0
Fatal error: Uncaught ValueError: Bad scan conversion character "." in /in/I1AVe:6
Stack trace:
#0 /in/I1AVe(6): sscanf('only 1 - 2.0', 'only %d - %.1f', NULL, NULL)
#1 {main}
thrown in /in/I1AVe on line 6
But I expected this output instead:
- no error, because shouldn't any format which is not marked as "not supported" in the docs work in both directions?
PHP Version
PHP 8.x
Operating System
No response
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
PHP の再現コードと sscanf() のフォーマット解析のエントリーポイントから始め、%.1f の処理を、文書化されている printf()/sprintf() の動作と比較してください。サポート対象のフォーマット動作が一貫した形で解決され、回帰テストでカバーされれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- c, php
- 領域
- backend
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 42/100