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

PhpMyAdmin\SqlParser\Exceptions\LoaderException: Specified context does not exist. #13728

Closed
caaguado opened this Issue Oct 11, 2017 · 4 comments

Comments

Projects
None yet
2 participants
@caaguado

caaguado commented Oct 11, 2017

Steps to reproduce

  1. Install a local copy of phpMyAdmin 4.7.4 english (https://files.phpmyadmin.net/phpMyAdmin/4.7.4/phpMyAdmin-4.7.4-english.zip). In my case, it is installed on path S:\xtack\bin\pma\
  2. Open phpMyAdmin' main page
  3. The Xdebug extension immediately raises 2 errors like this:

PhpMyAdmin\SqlParser\Exceptions\LoaderException: Specified context ("\PhpMyAdmin\SqlParser\Contexts\ContextMySql50557") does not exist. in S:\xtack\bin\pma\vendor\phpmyadmin\sql-parser\src\Context.php on line 460

Expected behaviour

No such errors detected by Xdebug should occur.

Actual behaviour

The Xdebug extension immediately raises 2 errors like this:


PhpMyAdmin\SqlParser\Exceptions\LoaderException: Specified context ("\PhpMyAdmin\SqlParser\Contexts\ContextMySql50557") does not exist. in S:\xtack\bin\pma\vendor\phpmyadmin\sql-parser\src\Context.php on line 460

Call Stack
1 | 0.0000 | 377304 | {main}( ) | ...\index.php:0
2 | 0.0000 | 380544 | require_once( 'S:\xtack\bin\pma\libraries\common.inc.php' ) | ...\index.php:20
3 | 0.0312 | 535184 | PhpMyAdmin\SqlParser\Context::loadClosest( ) | ...\common.inc.php:809
4 | 0.0312 | 535184 | PhpMyAdmin\SqlParser\Context::load( ) | ...\Context.php:496

Variables in local scope (#4)
$context = | S:\xtack\bin\pma\vendor\phpmyadmin\sql-parser\src\Context.php:462:string '\PhpMyAdmin\SqlParser\Contexts\ContextMySql50557' (length=48)

Besides, after those 2 Xdebug errors, many other phpMyAdmin warnings like this one pop up:


Cannot modify header information - headers already sent by (output started at S:\xtack\bin\pma\vendor\phpmyadmin\sql-parser\src\Context.php:462)

Server configuration

Operating system:
Microsoft Windows 7 Enterprise Multiprocessor Free Enterprise Edition SP1 64 bits version 6.1.7601

Web server:
nginx/1.13.5

Database:
Server: localhost - xtack (127.0.0.1 via TCP/IP)
Server type: MySQL
Server version: 5.5.57 - MySQL Community Server (GPL)
Protocol version: 10
User: **************
Server charset: UTF-8 Unicode (utf8)

PHP version:
PHP version: 7.1.10
Database client version: libmysql - mysqlnd 5.0.12-dev - 20150407 - $Id: b396954eeb2d1d9ed7902b8bae237b287f21ad9e $
PHP extension: mysqli curl mbstring

phpMyAdmin version:
4.7.4

Client configuration

Browser:
Firefox 56.0.0.6478 (64-bit)
Google Chrome 61.0.3163.100 (Official Build) (64-bit)
Microsoft Internet Explorer 11.0.9600.18792 - Update Versions 11.0.46 (KB4036586)

Operating system:
Microsoft Windows 7 Enterprise Multiprocessor Free Enterprise Edition SP1 64 bits version 6.1.7601

@nijel

This comment has been minimized.

Show comment
Hide comment
@nijel

nijel Oct 11, 2017

Member

These exceptions are properly handled by the code, why is raising an exception problem?

Member

nijel commented Oct 11, 2017

These exceptions are properly handled by the code, why is raising an exception problem?

@nijel nijel added the question label Oct 11, 2017

@nijel nijel self-assigned this Oct 11, 2017

@nijel nijel changed the title from PhpMyAdmin\SqlParser\Exceptions\LoaderException: Specified context ("\PhpMyAdmin\SqlParser\Contexts\ContextMySqlxxxxx") does not exist. in <phpmyadmin_local_installation_dir>\vendor\phpmyadmin\sql-parser\src\Context.php on line 460 (Xdebug) to PhpMyAdmin\SqlParser\Exceptions\LoaderException: Specified context does not exist. Oct 11, 2017

@caaguado

This comment has been minimized.

Show comment
Hide comment
@caaguado

caaguado Oct 11, 2017

caaguado commented Oct 11, 2017

@nijel nijel added the parser label Oct 11, 2017

@nijel

This comment has been minimized.

Show comment
Hide comment
@caaguado

This comment has been minimized.

Show comment
Hide comment
@caaguado

caaguado Oct 23, 2017

Hi nijel,

Again, there is no problem with an exception being thrown and properly handled per se. But the code is not running optimal, as long as one gets exceptions.

Now, if this issue is to be fixed, the software should be corrected so for it to instead of looking for a context file/class that includes the first digit in the minor MySQL version number in subfolder \vendor\phpmyadmin\sql-parser\src\Contexts\ right before the ".php" filename suffix, it should just look for the MySQL major version number, appending a "00" just before such ".php" filename suffix.

Example for MySQL 5.5.58 (with the aim to illustrate): phpMyAdmin 4.7.5 looks for context file \vendor\phpmyadmin\sql-parser\src\Contexts\ContextMySql50550.php, but since this file doesn't exist, an exception is thrown. Instead, phpMyAdmin should ignore the first digit of the MySQL's 5.5.58 minor version number (58, in this case) and actually load context file \vendor\phpmyadmin\sql-parser\src\Contexts\ContextMySql50500.php, which indeed does exist in that subfolder.

Otherwise, a context file including the first digit of MySQL's minor version number should be ideally provided with the code. That way, no exception would be thrown either.

Again, exceptions are things that are pointing out to abnormal situations that should be prevented if the long term quality of the software package is to be kept at a healthy level.

Thanks, Carlos.

caaguado commented Oct 23, 2017

Hi nijel,

Again, there is no problem with an exception being thrown and properly handled per se. But the code is not running optimal, as long as one gets exceptions.

Now, if this issue is to be fixed, the software should be corrected so for it to instead of looking for a context file/class that includes the first digit in the minor MySQL version number in subfolder \vendor\phpmyadmin\sql-parser\src\Contexts\ right before the ".php" filename suffix, it should just look for the MySQL major version number, appending a "00" just before such ".php" filename suffix.

Example for MySQL 5.5.58 (with the aim to illustrate): phpMyAdmin 4.7.5 looks for context file \vendor\phpmyadmin\sql-parser\src\Contexts\ContextMySql50550.php, but since this file doesn't exist, an exception is thrown. Instead, phpMyAdmin should ignore the first digit of the MySQL's 5.5.58 minor version number (58, in this case) and actually load context file \vendor\phpmyadmin\sql-parser\src\Contexts\ContextMySql50500.php, which indeed does exist in that subfolder.

Otherwise, a context file including the first digit of MySQL's minor version number should be ideally provided with the code. That way, no exception would be thrown either.

Again, exceptions are things that are pointing out to abnormal situations that should be prevented if the long term quality of the software package is to be kept at a healthy level.

Thanks, Carlos.

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