New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL parser error trying to run a prepared statement #14162

Closed
peterchaula opened this Issue Apr 5, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@peterchaula

peterchaula commented Apr 5, 2018

Steps to reproduce

Ran this query in the inline query box


 USE test;
 CREATE TABLE t1 (a INT NOT NULL);
 INSERT INTO t1 VALUES (4), (8), (11), (32), (80);

 SET @table = 't1';
 SET @s = CONCAT('SELECT * FROM ', @table);

PREPARE stmt3 FROM @s;
 EXECUTE stmt3;

DEALLOCATE PREPARE stmt3;

Expected behaviour

Must run query

Actual behaviour

Throws error:

Fatal error: Uncaught Error: Call to a member function getClauses() on null in /var/www/pma/libraries/sql-parser/src/Utils/Query.php:548 Stack trace: #0 /var/www/pma/libraries/sql-parser/src/Utils/Query.php(665): SqlParser\Utils\Query::getClause(NULL, NULL, 'ORDER BY', -1, false) #1 /var/www/pma/libraries/DisplayResults.php(1386): SqlParser\Utils\Query::replaceClause(NULL, NULL, 'ORDER BY', '') #2 /var/www/pma/libraries/DisplayResults.php(4369): PMA\libraries\DisplayResults->_getUnsortedSqlAndSortByKeyDropDown(Array, '') #3 /var/www/pma/libraries/sql.lib.php(1689): PMA\libraries\DisplayResults->getTable(Object(mysqli_result), Array, Array, false) #4 /var/www/pma/libraries/sql.lib.php(1980): PMA_getHtmlForSqlQueryResultsTable(Object(PMA\libraries\DisplayResults), './themes/pmahom...', NULL, Array, false, 5, 5, NULL, Object(mysqli_result), Array) #5 /var/www/pma/libraries/sql.lib.php(2199): PMA_getQueryResponseForResultsReturned(Object(mysqli_result), Array, 'test', '', NULL, NULL, Object(PMA\libraries\DisplayResults), './t in /var/www/pma/libraries/sql-parser/src/Utils/Query.php on line 548

image

Server configuration

Operating system: Debian Jessie

Web server: Apache 2.3

Database: Mariadb

PHP version: 7.2

phpMyAdmin version: 4.6.5.1

Client configuration

Browser: Firefox

Operating system: Ubuntu 16.04

nulll-pointer added a commit to nulll-pointer/phpmyadmin that referenced this issue Apr 9, 2018

Fix for error when running prepared statements, phpmyadmin#14162
Signed-Off-By: Lakshya arora <arora.lakshya123@gmail.com>

@mauriciofauth mauriciofauth self-assigned this Apr 24, 2018

@mauriciofauth

This comment has been minimized.

Member

mauriciofauth commented Apr 24, 2018

Duplicate of #13615

@mauriciofauth mauriciofauth marked this as a duplicate of #13615 Apr 24, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment