ErrorException: Attempt to read property "keyword" on null
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:
- 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);
- Click on
id - 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
Duplicate of #19155
Yeah, it's a duplicate. The bug is in this repo.
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
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?