phpmyadmin / phpmyadmin/phpmyadmin

Uncaught TypeError: Cannot read properties of undefined (reading 'value') and Undefined index: pred_hostname

Open
#17,547 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

affects/5.2 affects/6.0 Bug confirmed/5.2 confirmed/6.0
Dominant language
PHP
Stars
7.9k
Forks
3.6k
Avg merge
4d 18h
Merged PRs (30d)
36

Description

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:

  1. Edit privileges for a user account on a specific database
  2. Click on 'Go'
  3. 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',
,
,
)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the privilege-edit flow described in the issue, then inspect privileges.js at the reported handler and libraries/classes/Server/Privileges.php at the reported lines. Trace the request through PrivilegesController.php and compare the submitted fields with the accesses producing the notices. Done means the flow completes without the TypeError or undefined-index notices.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, mysql, php
Domain
backend, database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.