mysqli_change_user does not allow to use NULL for $database param
まだ誰も着手していません。
- 主要言語
- C
- スター
- 40.4k
- フォーク
- 8.1k
- 平均マージ
- 2日 13時間
- マージ済み PR(30日)
- 96
説明
Description
According to the documentation, the third parameter in mysqli_change_user is nullable (not optional though) and passing NULL should connect to the same database.
If desired, the null value may be passed resulting in only changing the user and not selecting a database. To select a database in this case use the mysqli_select_db() function.
But to my knowledge this was never possible and is still not supported by mysqli. This code will reset database to NULL
$mysqli = new mysqli("localhost", "my_user", "my_password", "test");
$mysqli->change_user("my_user", "my_password", null);
var_dump($mysqli->query("SELECT DATABASE()")->fetch_row()[0]);
Resulted in this output:
NULL
But I expected this output instead:
string(4) "test"
PHP Version
All versions
Operating System
No response
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
mysqli_change_user エントリポイントから開始し、文書化されている NULL の動作と提供された PHP の再現コードを比較します。NULL を渡すことで既存のデータベース選択が維持され、再現コードによって SELECT DATABASE() が引き続き "test" を返すことが確認できれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- php
- 領域
- database
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 42/100