phpmyadmin / phpmyadmin/phpmyadmin

ErrorException: Attempt to read property "keyword" on null

Open
#19,349 14 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug duplicate waiting on upstream
Dominant language
PHP
Stars
7.9k
Forks
3.6k
Avg merge
4d 18h
Merged PRs (30d)
36

Description

Describe the bug

When a table name contains dots, columns can't be sorted. The bug is in sql-parser it seems.

On 5.2.2-dev it gives the HTML code in modal, but on 6.0.0-dev I get this:

Internal error in ./vendor/phpmyadmin/sql-parser/src/Utils/Query.php#413
ErrorException: Attempt to read property "keyword" on null

https://github.com/phpmyadmin/sql-parser/blob/5c4dc472f1fcbe6467bac080d0a3538b2700ee31/src/Utils/Query.php#L413

To Reproduce

Steps to reproduce the behavior:

  1. Create table
CREATE TABLE `test.2024-11-01` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;

INSERT INTO `test.2024-11-01` (`id`) VALUES
(1),
(2);
  1. Click on id
  2. See error
Expected behavior

There should be no error when sorting columns inside a table name that contains dots.

Screenshots

https://github.com/user-attachments/assets/623cbf70-f1f1-4c24-a0dc-6e2fbf01cfad

Server configuration
  • PHP version: 8.4.0RC3
  • phpMyAdmin version: 5.2.2-dev, 6.0.0-dev

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 vendor/phpmyadmin/sql-parser/src/Utils/Query.php around line 413 and reproduce the failure using the provided CREATE TABLE statement, then sort the id column in phpMyAdmin. Trace how the dotted table name is parsed and verify the completed change lets column sorting succeed without the null-property error.

Written by the indexing model from the issue text.

Assessment

Tech stack
mysql, php, sql
Domain
backend, databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.