mysqli_change_user does not allow to use NULL for $database param
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- C
- Star
- 40.4k
- Fork
- 8.2k
- Merge trung bình
- 2 ngày 15 giờ
- Pull request đã merge (30 ngày)
- 103
Mô tả
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
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu từ entry point mysqli_change_user và so sánh hành vi NULL được ghi trong tài liệu với bản tái hiện PHP được cung cấp. Hoàn tất khi việc truyền NULL giữ nguyên lựa chọn cơ sở dữ liệu hiện tại và bản tái hiện xác nhận rằng SELECT DATABASE() vẫn trả về "test".
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- php
- Lĩnh vực
- database
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 42/100