phpmyadmin icon indicating copy to clipboard operation
phpmyadmin copied to clipboard

ErrorException: Attempt to read property "keyword" on null

Open liviuconcioiu opened this issue 1 year ago • 4 comments

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

liviuconcioiu avatar Nov 01 '24 08:11 liviuconcioiu

Duplicate of #19155

liviuconcioiu avatar Nov 01 '24 10:11 liviuconcioiu

Yeah, it's a duplicate. The bug is in this repo.

kamil-tekiela avatar Nov 01 '24 22:11 kamil-tekiela

Similar error. On phpMyAdmin v 5.2.2 and 5.2.3, using php v.3.1.8, when clicking any header to sort, I get a warning that begins with:

Warning in .\vendor\phpmyadmin\sql-parser\src\Utils\Query.php#661 Attempt to read property "keyword" on null

drrhf avatar Dec 05 '25 22:12 drrhf

Similar error. On phpMyAdmin v 5.2.2 and 5.2.3, using php v.3.1.8, when clicking any header to sort, I get a warning that begins with:

Warning in .\vendor\phpmyadmin\sql-parser\src\Utils\Query.php#661 Attempt to read property "keyword" on null

What is the table structure?

williamdes avatar Dec 08 '25 10:12 williamdes