phpmyadmin / phpmyadmin/phpmyadmin

Potential property access on `undefined`

Open
#18,312 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

good first issue newbie refactoring
Dominant language
PHP
Stars
7.9k
Forks
3.6k
Avg merge
4d 18h
Merged PRs (30d)
36

Description

Describe the bug

There exist lots of checks like typeof data [!=]== 'undefined' but then in both branches properties on data are accessed:
https://github.com/phpmyadmin/phpmyadmin/blob/e8087061c6aabc8d47cb4f742f2fd7fca40d0b22/js/src/makegrid.ts#L1059-L1067

Either the check is unnecessary and data is always an object or the error-case needs to handle data being undefined.

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

Start with the cited range in js/src/makegrid.ts around lines 1059-1067, then inspect similar typeof data checks in the surrounding frontend code. Determine whether data is guaranteed to be an object or whether both branches must safely handle undefined; done means the identified property accesses no longer contradict their guards and the relevant behavior remains covered by existing checks.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.