phpmyadmin
phpmyadmin copied to clipboard
Uncaught TypeError: Cannot read properties of undefined (reading 'value') and Undefined index: pred_hostname
Describe the bug
It happens when you edit privileges for a user account on a specific database. Also, a few more notices were given, which can be seen on the second video.
To Reproduce
Steps to reproduce the behavior:
- Edit privileges for a user account on a specific database
- Click on 'Go'
- See error
Expected behavior
No error should be given.
Screenshots
https://user-images.githubusercontent.com/25424343/169705655-0496b2f3-f5b2-47e6-8679-6bbae98ad971.mp4
https://user-images.githubusercontent.com/25424343/169706208-2329b175-c965-4edb-bf44-34d0dc4a746d.mp4
Server configuration
- Operating system: Linux
- Web server: nginx/1.14.2
- Database version: 8.0.18 - MySQL Community Server - GPL
- PHP version: 7.4.29
- phpMyAdmin version: 5.2.2-dev, 6.0.0-dev
Client configuration
- Browser: Chrome/101.0.4951.67
- Operating system: Windows 10
Additional context
tracekit.js?v=5.3.0-dev:342 Uncaught TypeError: Cannot read properties of undefined (reading 'value')
at HTMLFormElement.handleEvent (privileges.js:444:39)
at HTMLFormElement.newFunc (error_report.js:247:33)
at HTMLFormElement.dispatch (jquery.min.js?v=5.3.0-dev:2:43064)
at HTMLFormElement.v.handle (jquery.min.js?v=5.3.0-dev:2:41048)
Notice in ./libraries/classes/Server/Privileges.php#2566
Undefined index: pred_hostname
Backtrace
PrivilegesController.php#220: PhpMyAdmin\Server\Privileges->addUser(
NULL,
string '',
string '',
string '*6E1D683C148B73830421F1D93529DC187CF45107',
boolean false,
)
Routing.php#189: PhpMyAdmin\Controllers\Server\PrivilegesController->__invoke(
,
array,
)
index.php#44: PhpMyAdmin\Routing::callControllerForRoute(
,
string '/server/privileges',
,
,
)
Notice in ./libraries/classes/Server/Privileges.php#2566
Undefined index: pred_hostname
Backtrace
PrivilegesController.php#220: PhpMyAdmin\Server\Privileges->addUser(
NULL,
string '',
string '',
string '*6E1D683C148B73830421F1D93529DC187CF45107',
boolean false,
)
Routing.php#189: PhpMyAdmin\Controllers\Server\PrivilegesController->__invoke(
,
array,
)
index.php#44: PhpMyAdmin\Routing::callControllerForRoute(
,
string '/server/privileges',
,
,
)
Notice in ./libraries/classes/Server/Privileges.php#3545
Undefined index: pred_password
Backtrace
Privileges.php#2612: PhpMyAdmin\Server\Privileges->getSqlQueriesForDisplayAndAddUser(
string '',
string '',
string '*6E1D683C148B73830421F1D93529DC187CF45107',
)
PrivilegesController.php#220: PhpMyAdmin\Server\Privileges->addUser(
NULL,
string '',
string '',
string '*6E1D683C148B73830421F1D93529DC187CF45107',
boolean false,
)
Routing.php#189: PhpMyAdmin\Controllers\Server\PrivilegesController->__invoke(
,
array,
)
index.php#44: PhpMyAdmin\Routing::callControllerForRoute(
,
string '/server/privileges',
,
,
)
Notice in ./libraries/classes/Server/Privileges.php#3548
Undefined index: pred_password
Backtrace
Privileges.php#2612: PhpMyAdmin\Server\Privileges->getSqlQueriesForDisplayAndAddUser(
string '',
string '',
string '*6E1D683C148B73830421F1D93529DC187CF45107',
)
PrivilegesController.php#220: PhpMyAdmin\Server\Privileges->addUser(
NULL,
string '',
string '',
string '*6E1D683C148B73830421F1D93529DC187CF45107',
boolean false,
)
Routing.php#189: PhpMyAdmin\Controllers\Server\PrivilegesController->__invoke(
,
array,
)
index.php#44: PhpMyAdmin\Routing::callControllerForRoute(
,
string '/server/privileges',
,
,
)
Notice in ./libraries/classes/Server/Privileges.php#3559
Undefined index: pma_pw
Backtrace
Privileges.php#2612: PhpMyAdmin\Server\Privileges->getSqlQueriesForDisplayAndAddUser(
string '',
string '',
string '*6E1D683C148B73830421F1D93529DC187CF45107',
)
PrivilegesController.php#220: PhpMyAdmin\Server\Privileges->addUser(
NULL,
string '',
string '',
string '*6E1D683C148B73830421F1D93529DC187CF45107',
boolean false,
)
Routing.php#189: PhpMyAdmin\Controllers\Server\PrivilegesController->__invoke(
,
array,
)
index.php#44: PhpMyAdmin\Routing::callControllerForRoute(
,
string '/server/privileges',
,
,
)
Notice in ./libraries/classes/Server/Privileges.php#2660
Undefined index: username
Backtrace
PrivilegesController.php#220: PhpMyAdmin\Server\Privileges->addUser(
NULL,
string '',
string '',
string '*6E1D683C148B73830421F1D93529DC187CF45107',
boolean false,
)
Routing.php#189: PhpMyAdmin\Controllers\Server\PrivilegesController->__invoke(
,
array,
)
index.php#44: PhpMyAdmin\Routing::callControllerForRoute(
,
string '/server/privileges',
,
,
)
On 6.0.0-dev, this error is given
TypeError: PhpMyAdmin\Server\Privileges::setUserGroup(): Argument #1 ($username) must be of type string, null given, called in /home/demo/.pma-demo/master-config/libraries/classes/Server/Privileges.php on line 2365
I am looking into this, but do you know what the correct behaviour should be? What should actually happen after you click go? It's not like there are any input fields to change any information on this page.
I am looking into this, but do you know what the correct behaviour should be? What should actually happen after you click go? It's not like there are any input fields to change any information on this page.
I think this message should be shown, if Go
is clicked.
Username and hostname didn't change. If you only want to change the password, 'Change password' tab should be used.
For example, the Login Information
tab, contains a form when you edit user privileges, but this form is missing when a database is selected.
@williamdes thoughts?
That would make this tab completely useless. I have a feeling this tab should not be available when database is selected. I can't imagine any reason to use it.
it really feels weird all that stuff about re creating the user or adding a new one when you just want to edit it
In this case I do not see why there should be an error The code is probably deeply broken, the pred_* stuff always comes back in corner cases We should refactor it in a cleaner way